index
int64
0
0
repo_id
stringlengths
9
205
file_path
stringlengths
31
246
content
stringlengths
1
12.2M
__index_level_0__
int64
0
10k
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi/gssup/GSSUPPolicyValue.java
/** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.csi.gssup; public final class GSSUPPolicyValue implements org.omg.CORBA.portable.IDLEntity { public GSSUPPolicyValue() { } public org.omg.Security.RequiresSupports mode; public java.lang.String domain; public GSSUPPolicyValue(org.omg.Security.RequiresSupports mode, java.lang.String domain) { this.mode = mode; this.domain = domain; } }
6,200
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi/gssup/GSSUPPolicyOperations.java
/** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.csi.gssup; /** * Generated by the JacORB IDL compiler. */ public interface GSSUPPolicyOperations extends org.omg.CORBA.PolicyOperations { public org.omg.Security.RequiresSupports mode(); public java.lang.String domain(); }
6,201
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi/gssup/SecGSSUPPolicy.java
/** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.csi.gssup; /** * Generated by the JacORB IDL compiler * from an IDL const definition */ public interface SecGSSUPPolicy { int value = 8080; }
6,202
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/csi/gssup/GSSUPPolicy.java
/** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.csi.gssup; /** * Generated by the JacORB IDL compiler. */ public interface GSSUPPolicy extends GSSUPPolicyOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity, org.omg.CORBA.Policy { }
6,203
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/BiDirPolicy/BidirectionalPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.BiDirPolicy; import org.omg.BiDirPolicy.*; public final class BidirectionalPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.BiDirPolicy.BidirectionalPolicy { private short value_; public BidirectionalPolicy_impl(short value) { value_ = value; } public short value() { return value_; } public int policy_type() { return BIDIRECTIONAL_POLICY_TYPE.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,204
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/util/UnmodifiableEnumMap.java
package org.apache.yoko.orb.util; import java.util.Collection; import java.util.Collections; import java.util.EnumMap; import java.util.Map; import java.util.Set; public abstract class UnmodifiableEnumMap<K extends Enum<K>, V> extends EnumMap<K, V> { private static final long serialVersionUID = 1L; public UnmodifiableEnumMap(Class<K> keyType) { super(keyType); // initialise all values up front to avoid races later for(K key : keyType.getEnumConstants()) super.put(key, computeValueFor(key)); } protected abstract V computeValueFor(K key); @Override public final V remove(Object key) { throw new UnsupportedOperationException(); } @Override public final V put(K key, V value) { throw new UnsupportedOperationException(); } @Override public final void putAll(Map<? extends K, ? extends V> m) { throw new UnsupportedOperationException(); } @Override public final Set<K> keySet() { return Collections.unmodifiableSet(super.keySet()); } @Override public final Collection<V> values() { return Collections.unmodifiableCollection(super.values()); } }
6,205
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/util/AutoReadWriteLock.java
package org.apache.yoko.orb.util; import java.util.concurrent.locks.ReentrantReadWriteLock; public class AutoReadWriteLock { private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); public AutoLock getReadLock() { return new AutoLock(lock.readLock()); } public AutoLock getWriteLock() { return new AutoLock(lock.writeLock(), lock.readLock(), lock.getReadHoldCount()); } }
6,206
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/util/AutoLock.java
package org.apache.yoko.orb.util; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; public class AutoLock implements AutoCloseable { final AtomicReference<Lock> lockRef; final Lock downgradeLock; final int downgradeHeld; AutoLock(Lock lock) { this(lock, null, 0); } AutoLock(Lock lock, Lock downgradeLock, int downgradeHeld) { lockRef = new AtomicReference<>(lock); this.downgradeLock = downgradeLock; this.downgradeHeld = downgradeHeld; for (int i = downgradeHeld; i > 0; i--) { downgradeLock.unlock(); } lock.lock(); } @Override public void close() { Lock lock = lockRef.getAndSet(null); if (lock == null) return; for (int i = 0; i < downgradeHeld; i++) { downgradeLock.lock(); } lock.unlock(); } public Condition newCondition() { return lockRef.get().newCondition(); } public boolean downgrade() { if (downgradeLock == null) return false; Lock oldLock = lockRef.getAndSet(downgradeLock); if (oldLock == downgradeLock) return false; downgradeLock.lock(); oldLock.unlock(); return true; } }
6,207
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/util/GetSystemPropertyAction.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.util; import java.security.PrivilegedAction; /** * Simple utility class for retrieving a system property * value using the AccessController. */ public class GetSystemPropertyAction implements PrivilegedAction { // property name to retrieve String name; // potential default value String defaultValue = null; /** * Retrive a value using the name with no default value. * * @param name The property name. */ public GetSystemPropertyAction(String name) { this.name = name; this.defaultValue = null; } /** * Retrieve a property using a name and a specified default value. * * @param name The property name. * @param defaultValue * The default value if the property has not been set. */ public GetSystemPropertyAction(String name, String defaultValue) { this.name = name; this.defaultValue = defaultValue; } /** * Perform the AccessController action of retrieving the system property. * * @return The retrieved property. Returns either null or the * specified default value if this has not been set. */ public java.lang.Object run() { if (defaultValue == null) { return System.getProperty(name); } else { return System.getProperty(name, defaultValue); } } }
6,208
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ClientProfilePair.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // A client/profile pair // public final class ClientProfilePair { public Client client; public org.apache.yoko.orb.OCI.ProfileInfo profile; }
6,209
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PIDowncall.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.util.AutoLock; public class PIDowncall extends Downcall { // // The IOR and the original IOR // protected org.omg.IOP.IOR IOR_; protected org.omg.IOP.IOR origIOR_; // // The PortableInterceptor manager // protected PIManager piManager_; // // Holds the exception ID if state_ is DowncallStateUserException, // DowncallStateSystemException, or DowncallStateFailureException // // In Java, this field is in Downcall // // protected String exId_; // // The ClientRequestInfo object provided by the interceptors // protected org.omg.PortableInterceptor.ClientRequestInfo requestInfo_; // ---------------------------------------------------------------------- // PIDowncall private and protected member implementations // ---------------------------------------------------------------------- void checkForException() throws LocationForward, FailureException { try (AutoLock lock = stateLock.getReadLock()) { // // If ex_ is set, but exId_ is not, then set it now // // TODO: Postpone this in Java? // if (ex_ != null && exId_ == null) exId_ = Util.getExceptionId(ex_); switch (state) { case USER_EXCEPTION: // // For Java portable stubs, we'll have the repository ID // but not the exception instance, so we pass UNKNOWN to // the interceptors but DO NOT modify the Downcall state. // if (ex_ == null && exId_ != null) { org.omg.CORBA.Any any = new org.apache.yoko.orb.CORBA.Any( orbInstance_); org.omg.CORBA.UNKNOWN sys = new org.omg.CORBA.UNKNOWN( MinorCodes .describeUnknown(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownUserException) + ": " + exId_, org.apache.yoko.orb.OB.MinorCodes.MinorUnknownUserException, org.omg.CORBA.CompletionStatus.COMPLETED_YES); org.omg.CORBA.UNKNOWNHelper.insert(any, sys); org.omg.CORBA.UnknownUserException unk = new org.omg.CORBA.UnknownUserException( any); piManager_.clientReceiveException(requestInfo_, false, unk, exId_); } // // Only invoke interceptor if a user exception has been // set // if (ex_ != null) piManager_.clientReceiveException(requestInfo_, false, ex_, exId_); break; case SYSTEM_EXCEPTION: Assert._OB_assert(ex_ != null); piManager_.clientReceiveException(requestInfo_, true, ex_, exId_); break; case FAILURE_EXCEPTION: try { Assert._OB_assert(ex_ != null); piManager_.clientReceiveException(requestInfo_, true, ex_, exId_); } catch (org.omg.CORBA.SystemException ex) { // // Ignore any exception translations for failure // exceptions // } break; case FORWARD: case FORWARD_PERM: Assert._OB_assert(forwardIOR_ != null); piManager_.clientReceiveLocationForward(requestInfo_, forwardIOR_); break; default: break; } super.checkForException(); } } // ---------------------------------------------------------------------- // PIDowncall public member implementations // ---------------------------------------------------------------------- public PIDowncall(ORBInstance orbInstance, Client client, org.apache.yoko.orb.OCI.ProfileInfo profileInfo, RefCountPolicyList policies, String op, boolean resp, org.omg.IOP.IOR IOR, org.omg.IOP.IOR origIOR, /**/PIManager piManager) { super(orbInstance, client, profileInfo, policies, op, resp); IOR_ = IOR; origIOR_ = origIOR; piManager_ = piManager; } public org.apache.yoko.orb.CORBA.OutputStream preMarshal() throws LocationForward, FailureException { requestInfo_ = piManager_.clientSendRequest(op_, responseExpected_, IOR_, origIOR_, profileInfo_, policies_.value, requestSCL_, replySCL_); return super.preMarshal(); } public void postUnmarshal() throws LocationForward, FailureException { try (AutoLock lock = stateLock.getReadLock()) { // // If the result of this downcall is a user exception, but no user // exception could be unmarshalled, then use the system exception // UNKNOWN, but keep the original exception ID // // In Java, the portable stubs only provide the repository ID of // the user exception, not the exception instance. We want to // report UNKNOWN to the interceptors, but do not want to change // the downcall status if we have the repository ID. // if (state == State.USER_EXCEPTION && ex_ == null && exId_ == null) { String id = unmarshalExceptionId(); setSystemException(new org.omg.CORBA.UNKNOWN(org.apache.yoko.orb.OB.MinorCodes .describeUnknown(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownUserException) + ": " + id, org.apache.yoko.orb.OB.MinorCodes.MinorUnknownUserException, org.omg.CORBA.CompletionStatus.COMPLETED_YES)); exId_ = id; } super.postUnmarshal(); // // Java only - Downcall.checkForException() does not raise // UserExceptions, so we return now and let the stub handle it // if (state == State.USER_EXCEPTION) return; if (responseExpected_) Assert._OB_assert(state == State.NO_EXCEPTION); else Assert._OB_assert(state == State.UNSENT || state == State.NO_EXCEPTION); piManager_.clientReceiveReply(requestInfo_); } } public void setUserException(org.omg.CORBA.UserException ex, String exId) { super.setUserException(ex, exId); exId_ = exId; } }
6,210
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/InvalidThreadPoolHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/InvalidThreadPool:1.0 // final public class InvalidThreadPoolHelper { public static void insert(org.omg.CORBA.Any any, InvalidThreadPool val) { org.omg.CORBA.portable.OutputStream out = any.create_output_stream(); write(out, val); any.read_value(out.create_input_stream(), type()); } public static InvalidThreadPool extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return read(any.create_input_stream()); else throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[0]; typeCode_ = orb.create_exception_tc(id(), "InvalidThreadPool", members); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/InvalidThreadPool:1.0"; } public static InvalidThreadPool read(org.omg.CORBA.portable.InputStream in) { if(!id().equals(in.read_string())) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadIDMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorReadIDMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } InvalidThreadPool _ob_v = new InvalidThreadPool(); return _ob_v; } public static void write(org.omg.CORBA.portable.OutputStream out, InvalidThreadPool val) { out.write_string(id()); } }
6,211
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/URLRegistry_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.URLRegistry; import org.apache.yoko.orb.OB.URLScheme; public class URLRegistry_impl extends org.omg.CORBA.LocalObject implements URLRegistry { private java.util.Hashtable schemes_ = new java.util.Hashtable(); // ------------------------------------------------------------------ // URLRegistry_impl constructor // ------------------------------------------------------------------ public URLRegistry_impl() { } // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public void add_scheme(URLScheme scheme) throws org.apache.yoko.orb.OB.URLRegistryPackage.SchemeAlreadyExists { String name = scheme.name(); if (schemes_.containsKey(name)) throw new org.apache.yoko.orb.OB.URLRegistryPackage.SchemeAlreadyExists(); schemes_.put(name, scheme); } public URLScheme find_scheme(String name) { return (URLScheme) schemes_.get(name); } public org.omg.CORBA.Object parse_url(String url) { if (url == null) throw new org.omg.CORBA.BAD_PARAM(); int colon = url.indexOf(':'); if (colon <= 0) throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeName), org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeName, org.omg.CORBA.CompletionStatus.COMPLETED_NO); String name = url.substring(0, colon).toLowerCase(); URLScheme scheme = find_scheme(name); if (scheme == null) throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeName), org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeName, org.omg.CORBA.CompletionStatus.COMPLETED_NO); String urlCopy = name + url.substring(colon); return scheme.parse_url(urlCopy); } public void destroy() { java.util.Enumeration e = schemes_.elements(); while (e.hasMoreElements()) { URLScheme scheme = (URLScheme) e.nextElement(); scheme.destroy(); } schemes_.clear(); } }
6,212
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PROTOCOL_POLICY_ID.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/PROTOCOL_POLICY_ID:1.0 // /** * * This policy type identifies the protocol policy. * **/ public interface PROTOCOL_POLICY_ID { int value = (int)(1330577410L); }
6,213
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionStrategyOperations.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/UnknownExceptionStrategy:1.0 // /** * * The unknown exception strategy interface. * **/ public interface UnknownExceptionStrategyOperations { // // IDL:orb.yoko.apache.org/OB/UnknownExceptionStrategy/unknown_exception:1.0 // /** * * Handle an unknown exception. * * @param info Information about the exception. * **/ void unknown_exception(UnknownExceptionInfo info); // // IDL:orb.yoko.apache.org/OB/UnknownExceptionStrategy/destroy:1.0 // /** * * Clean up resources prior to ORB destruction. * **/ void destroy(); }
6,214
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RetryAttributesHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RetryAttributes:1.0 // final public class RetryAttributesHelper { public static void insert(org.omg.CORBA.Any any, RetryAttributes val) { org.omg.CORBA.portable.OutputStream out = any.create_output_stream(); write(out, val); any.read_value(out.create_input_stream(), type()); } public static RetryAttributes extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return read(any.create_input_stream()); else throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[4]; members[0] = new org.omg.CORBA.StructMember(); members[0].name = "mode"; members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short); members[1] = new org.omg.CORBA.StructMember(); members[1].name = "interval"; members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong); members[2] = new org.omg.CORBA.StructMember(); members[2].name = "max"; members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong); members[3] = new org.omg.CORBA.StructMember(); members[3].name = "remote"; members[3].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean); typeCode_ = orb.create_struct_tc(id(), "RetryAttributes", members); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/RetryAttributes:1.0"; } public static RetryAttributes read(org.omg.CORBA.portable.InputStream in) { RetryAttributes _ob_v = new RetryAttributes(); _ob_v.mode = in.read_short(); _ob_v.interval = in.read_ulong(); _ob_v.max = in.read_ulong(); _ob_v.remote = in.read_boolean(); return _ob_v; } public static void write(org.omg.CORBA.portable.OutputStream out, RetryAttributes val) { out.write_short(val.mode); out.write_ulong(val.interval); out.write_ulong(val.max); out.write_boolean(val.remote); } }
6,215
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/URLUtil.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; class URLUtil { // // Remove URL escape sequences from a string // public static String unescapeURL(final String str) { final int len = str.length(); char[] buf = new char[len]; int bpos = 0, pos = 0; while (pos < len) { char ch = str.charAt(pos); // // Escape sequence '%' must be followed by // 2 valid characters 0-9, A-F, a-f // if (ch == '%') { if (pos + 2 >= len) throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress) + ": bad escape sequence length", org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress, org.omg.CORBA.CompletionStatus.COMPLETED_NO); int c1 = Character.digit(str.charAt(++pos), 16); int c2 = Character.digit(str.charAt(++pos), 16); if (c1 == -1 || c2 == -1) throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorOther) + ": escape sequence contains invalid characters", org.apache.yoko.orb.OB.MinorCodes.MinorOther, org.omg.CORBA.CompletionStatus.COMPLETED_NO); ch = (char) ((c1 << 4) | c2); } buf[bpos++] = ch; ++pos; } return new String(buf, 0, bpos); } }
6,216
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CallStackHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CallStack:1.0 // final public class CallStackHolder implements org.omg.CORBA.portable.Streamable { public String[] value; public CallStackHolder() { } public CallStackHolder(String[] initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = CallStackHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { CallStackHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return CallStackHelper.type(); } }
6,217
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RequestTimeoutPolicyOperations.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RequestTimeoutPolicy:1.0 // /** * * The request timeout policy. This policy can be used to specify * a maximum time limit for requests. * * @see TimeoutPolicy * **/ public interface RequestTimeoutPolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OB/RequestTimeoutPolicy/value:1.0 // /** * * If an object has a <code>RequestTimeoutPolicy</code> set and no * response to a request is available after <code>value</code> * milliseconds, a <code>CORBA::NO_RESPONSE</code> exception is * raised. The default value is <code>-1</code>, which means no * timeout. * **/ int value(); }
6,218
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/InterceptorPolicy.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/InterceptorPolicy:1.0 // /** * * The interceptor policy. This policy can be used to control whether * the client-side interceptors are called. * **/ public interface InterceptorPolicy extends InterceptorPolicyOperations, org.omg.CORBA.Policy { }
6,219
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/OB_Extras.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import static org.apache.yoko.orb.OCI.GiopVersion.GIOP1_0; import org.apache.yoko.orb.OCI.GiopVersion; public interface OB_Extras { // // Whether or not we are building a server capable of the // legacy compatible wide-char marshaling/unmarshaling // public final boolean COMPAT_WIDE_MARSHAL = false; // // the default GIOP Version to set for the streams // public final GiopVersion DEFAULT_GIOP_VERSION = GIOP1_0; }
6,220
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionInfoHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo:1.0 // final public class UnknownExceptionInfoHelper { public static void insert(org.omg.CORBA.Any any, UnknownExceptionInfo val) { any.insert_Object(val, type()); } public static UnknownExceptionInfo extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "UnknownExceptionInfo"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo:1.0"; } public static UnknownExceptionInfo read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, UnknownExceptionInfo val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static UnknownExceptionInfo narrow(org.omg.CORBA.Object val) { try { return (UnknownExceptionInfo)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,221
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionInfoHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo:1.0 // final public class UnknownExceptionInfoHolder implements org.omg.CORBA.portable.Streamable { public UnknownExceptionInfo value; public UnknownExceptionInfoHolder() { } public UnknownExceptionInfoHolder(UnknownExceptionInfo initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = UnknownExceptionInfoHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { UnknownExceptionInfoHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return UnknownExceptionInfoHelper.type(); } }
6,222
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/OAInterface.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; public interface OAInterface { // // Create new Upcall object // Upcall createUpcall(UpcallReturn upcallReturn, org.apache.yoko.orb.OCI.ProfileInfo profileInfo, org.apache.yoko.orb.OCI.TransportInfo transportInfo, int requestId, String op, org.apache.yoko.orb.CORBA.InputStream in, org.omg.IOP.ServiceContext[] requestSCL); // // Determine if an object with the provided object key exists // // This enumeration mirrors the GIOP::LocateStatusType_1_2 // int UNKNOWN_OBJECT = 0; int OBJECT_HERE = 1; int OBJECT_FORWARD = 2; int OBJECT_FORWARD_PERM = 3; int findByKey(byte[] key, org.omg.IOP.IORHolder ior); // // Get all profiles that are usable with this OAInterface // org.apache.yoko.orb.OCI.ProfileInfo[] getUsableProfiles( org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] policies); // // Discard all incoming requests with a TRANSIENT exception // void discard(); // // Allow associated POAs to receive requests // void activate(); }
6,223
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueWriter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import java.io.Serializable; import javax.rmi.CORBA.ValueHandler; import org.apache.yoko.util.cmsf.RepIds; import org.apache.yoko.osgi.ProviderLocator; import org.omg.CORBA.WStringValueHelper; import org.omg.CORBA.portable.BoxedValueHelper; import org.omg.CORBA.portable.IDLEntity; final public class ValueWriter { // // The OutputStream // private org.apache.yoko.orb.CORBA.OutputStream out_; // // The Buffer // private org.apache.yoko.orb.OCI.Buffer buf_; // // Are we currently writing chunks? // private boolean chunked_ = false; // // The nesting level of chunked valuetypes // private int nestingLevel_ = 0; // // True if we need to start a new chunk before the next write to the // output stream // private boolean needChunk_; // // The position in the buffer at which we need to patch the chunk size // private int chunkSizePos_; // // The position in the buffer of the last end tag // private int lastEndTagPos_; // // Keep track of the last end tag we've written (Java only) // private int lastTag_ = 0; // // These members are needed for indirection in valuetype marshalling. // instanceTable_ records the position at which a valuetype was // marshalled. idTable_ records the position of a repository ID. // idListTable_ records the position of a list of repository IDs. // private java.util.IdentityHashMap instanceTable_; private java.util.Hashtable idTable_; private java.util.Hashtable idListTable_; private java.util.Hashtable codebaseTable_; private ValueHandler valueHandler; // // Helper class for using a String array as the key in a Hashtable // private class StringSeqHasher { String[] seq_; int hashCode_; StringSeqHasher(String[] seq) { seq_ = seq; hashCode_ = 0; for (int i = 0; i < seq.length; i++) hashCode_ ^= seq[i].hashCode(); } public int hashCode() { return hashCode_; } public boolean equals(Object o) { StringSeqHasher h = (StringSeqHasher) o; if (h.seq_.length != seq_.length) return false; for (int i = 0; i < h.seq_.length; i++) if (!h.seq_[i].equals(seq_[i])) return false; return true; } } // ------------------------------------------------------------------ // Private and protected methods // ------------------------------------------------------------------ private boolean checkIndirection(java.io.Serializable value) { Integer pos = (Integer) instanceTable_.get(value); if (pos != null) { // // Write indirection // out_.write_long(-1); int p = pos.intValue(); // Align p += 3; p -= p & 0x3; int off = p - buf_.pos_; out_.write_long(off); return true; } return false; } private void beginChunk() { Assert._OB_assert(chunked_); // // Write a placeholder for the chunk size // out_.write_long(0); // // Remember the position of the placeholder // chunkSizePos_ = buf_.pos_ - 4; } private void endChunk() { Assert._OB_assert(chunked_); // // If chunkSizePos_ > 0, then there is a chunk whose size needs to // be updated // if (chunkSizePos_ > 0) { // // Compute size of chunk // int size = buf_.pos_ - (chunkSizePos_ + 4); // // Update chunk size // int savePos = buf_.pos_; buf_.pos_ = chunkSizePos_; out_.write_long(size); buf_.pos_ = savePos; chunkSizePos_ = 0; } } private BoxedValueHelper getHelper(java.io.Serializable value, org.omg.CORBA.TypeCode type) { BoxedValueHelper result = null; Class helperClass = null; final Class<?> valueClass = value.getClass(); //Short-cuts if (String.class == valueClass) { return new WStringValueHelper(); } else if (!!!IDLEntity.class.isAssignableFrom(valueClass)) { return null; } // // First try constructing a class name based on the class of // the value. This will only work for primitive types, because // a distinct valuetype class is generated for boxed primitive // types. For constructed types, this will obtain the Helper of // the boxed type, which is not a BoxedValueHelper. // try { String name = value.getClass().getName() + "Helper"; // get the appropriate class for the loading. Class c = ProviderLocator.loadClass(name, value.getClass(), Thread.currentThread().getContextClassLoader()); if (BoxedValueHelper.class.isAssignableFrom(c)) helperClass = c; } catch (ClassNotFoundException ex) { } // // If we have a TypeCode, then use the TypeCode's repository ID // to locate a Helper class // if (helperClass == null && type != null) { try { org.omg.CORBA.TypeCode origType = org.apache.yoko.orb.CORBA.TypeCode ._OB_getOrigType(type); String id = origType.id(); helperClass = RepIds.query(id).suffix("Helper").toClass(); } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) { Assert._OB_assert(ex); } } // // Instantiate the Helper // if (helperClass != null) { try { result = (BoxedValueHelper) helperClass.newInstance(); } catch (ClassCastException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } } return result; } // ------------------------------------------------------------------ // Public methods // ------------------------------------------------------------------ public ValueWriter(org.apache.yoko.orb.CORBA.OutputStream out) { out_ = out; buf_ = out._OB_buffer(); chunked_ = false; nestingLevel_ = 0; needChunk_ = false; chunkSizePos_ = 0; lastEndTagPos_ = 0; instanceTable_ = new java.util.IdentityHashMap(131); idTable_ = new java.util.Hashtable(131); idListTable_ = new java.util.Hashtable(131); codebaseTable_ = new java.util.Hashtable(3); } public void writeValue(java.io.Serializable value, String id) { if (value == null) out_.write_long(0); else if (!checkIndirection(value)) { boolean isStreamable = (value instanceof org.omg.CORBA.portable.StreamableValue); boolean isCustom = (value instanceof org.omg.CORBA.CustomMarshal); // // if the repositoryId begins with "RMI:" we force the // transmission of this repositoryId in order to // interoperate with servers such as WebSphere which don't // recognize the 0x7fffff00 value properly // boolean rmiCompatMode = false; if (id != null) { String upperId = id.toUpperCase(); rmiCompatMode = upperId.startsWith("RMI:"); } // // writeValue may be called for a valuebox when the type // in use is CORBA::ValueBase. We know we've been given a // valuebox when the value does not implement StreamableValue // or CustomMarshal. // if (!isStreamable && !isCustom) { BoxedValueHelper helper = getHelper (value, null); if (helper == null) { writeRMIValue (value, id); } else { writeValueBox (value, null, helper); } return; } org.omg.CORBA.portable.ValueBase vb = (org.omg.CORBA.portable.ValueBase) value; String[] truncIds = vb._truncatable_ids(); String valueId = truncIds[0]; boolean isTruncatable = (truncIds.length > 1); // // Determine if the actual type matches the formal type // boolean typeMatch = (id != null && id.equals(valueId)); // // Chunking is necessary when: // // * value is custom // * value is truncatable and actual type does not match the // formal type // boolean chunked = false; if (isCustom || (isTruncatable && !typeMatch)) chunked = true; // // Value header // // Determine whether we need to transmit repository ID information // for this value. This is necessary when: // // * The formal type wasn't supplied or doesn't match the actual // type // * This is a nested value and it is truncatable // int tag; String[] ids; if (rmiCompatMode || !typeMatch || (nestingLevel_ > 1 && isTruncatable)) { if (isTruncatable) { // // Value is truncatable, so write the tag and then // a sequence of strings representing the repository // IDs of the truncatable base types. // // The tag is 0x7fffff00 + 0x06 (partial type information) // tag = 0x7fffff06; // // TODO: We could optimize the list of identifiers by // analyzing the receiving context (see GIOP spec) // ids = truncIds; } else { // // No formal ID was provided, or the formal ID doesn't // match the actual ID, so we need to send a single // repository ID. // // The tag is 0x7fffff00 + 0x02 (single ID) // tag = 0x7fffff02; ids = new String[1]; ids[0] = valueId; } } else { // // The value's dynamic type matches the type of the // position being marshalled, so we just need to // marshal the tag (no repository ID). // // The tag is 0x7fffff00 // tag = 0x7fffff00; ids = new String[0]; } int startPos = beginValue(tag, ids, null, chunked); instanceTable_.put(value, new Integer(startPos)); // // Marshal the value data // if (isStreamable) { ((org.omg.CORBA.portable.StreamableValue) value)._write(out_); } else // must be custom { org.omg.CORBA.DataOutputStream out = new org.apache.yoko.orb.CORBA.DataOutputStream( out_); ((org.omg.CORBA.CustomMarshal) value).marshal(out); } endValue(); } } private void writeRMIValue(Serializable value, String id) { // check if it is the null object if (value == null) { out_.write_long(0); return; } // check if this value has already been written if (checkIndirection(value)) { return; } // special-case string if (value instanceof java.lang.String) { //out_._OB_align(4); int pos = out_._OB_pos(); org.omg.CORBA.WStringValueHelper.write (out_, (String)value); instanceTable_.put (value, new Integer (pos)); return; } // get hold of the value handler if (valueHandler == null) { valueHandler = javax.rmi.CORBA.Util.createValueHandler (); } // // Needs writeReplace? // java.io.Serializable repValue = valueHandler.writeReplace (value); java.io.Serializable originalValue = null; // // Repeat base checks if value was replaced // if (value != repValue) { if (repValue == null) { out_.write_long(0); return; } if (checkIndirection(repValue)) { return; } if (repValue instanceof java.lang.String) { int pos = out_._OB_pos(); org.omg.CORBA.WStringValueHelper.write (out_, (String)repValue); instanceTable_.put (repValue, new Integer (pos)); // we record the original value position so that another attempt to write out // the original object will resolve to the same object. instanceTable_.put (value, new Integer (pos)); return; } // save the original value because we want to record that object in the // indirection table also, once we've established the offset position. originalValue = value; value = repValue; } // // Get the class object for the value // Class clz = value.getClass (); // // 0x7fffff00 + SINGLE_ID // int tag = 0x7fffff02; String codebase = javax.rmi.CORBA.Util.getCodebase (clz); if (codebase != null && codebase.length () != 0) tag |= 1; // // Determine the repository ID // String[] ids = new String[1]; ids[0] = valueHandler.getRMIRepositoryID (clz); // // Determine if chunked encoding is needed. // boolean isChunked = valueHandler.isCustomMarshaled(clz); int pos = beginValue (tag, ids, codebase, isChunked); instanceTable_.put (value, new Integer (pos)); // if this was replace via writeReplace, record the original // value in the indirection table too. if (originalValue != null) { instanceTable_.put (originalValue, new Integer (pos)); } valueHandler.writeValue (out_, value); endValue (); } public void writeValueBox(java.io.Serializable value, org.omg.CORBA.TypeCode type, org.omg.CORBA.portable.BoxedValueHelper helper) { if (value == null) out_.write_long(0); else if (!checkIndirection(value)) { // // Try to get Helper if one wasn't provided // if (helper == null) helper = getHelper(value, type); // // Raise MARSHAL if no Helper was found // if (helper == null) throw new org.omg.CORBA.MARSHAL(org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorNoValueFactory) + ": no helper for valuebox", org.apache.yoko.orb.OB.MinorCodes.MinorNoValueFactory, org.omg.CORBA.CompletionStatus.COMPLETED_NO); // // Setup header // String[] ids = new String[1]; ids[0] = helper.get_id(); int tag = 0x7fffff02; // // Marshal value // int startPos = beginValue(tag, ids, null, false); instanceTable_.put(value, new Integer(startPos)); helper.write_value(out_, value); endValue(); } } public void writeAbstractInterface(java.lang.Object obj) { if (obj != null) { if (obj instanceof org.omg.CORBA.Object) { out_.write_boolean(true); // discriminator for objref out_.write_Object((org.omg.CORBA.Object) obj); } else if (obj instanceof java.io.Serializable) { out_.write_boolean(false); // discriminator for valuetype writeValue((java.io.Serializable) obj, null); } else throw new org.omg.CORBA.MARSHAL("Object of class " + obj.getClass().getName() + " is not an object reference or valuetype"); } else { // // A nil abstract interface is marshalled as a null valuetype // out_.write_boolean(false); // discriminator for valuetype out_.write_long(0); } } public int beginValue(int tag, String[] ids, String codebase, boolean chunk) { if(chunk) chunked_ = true; if (chunked_) { tag |= 0x08; nestingLevel_++; needChunk_ = false; // // If nestingLevel_ > 1, then we are about to marshal a chunked, // nested valuetype. We must end the previous chunk first. // if (nestingLevel_ > 1) endChunk(); } // // Write value header // out_.write_long(tag); int startPos = buf_.pos_ - 4; // start of value // write codebase if present if ((tag & 0x00000001) == 1) { // check for indirection of codebase Integer pos = (Integer)codebaseTable_.get(codebase); if (pos != null) { out_.write_long(-1); int off = pos.intValue() - buf_.pos_; out_.write_long(off); } else { codebaseTable_.put(codebase, new Integer(buf_.pos_)); out_.write_string(codebase); } } if ((tag & 0x00000006) == 6) { // // Check for possible indirection of repository IDs // StringSeqHasher key = new StringSeqHasher(ids); Integer pos = (Integer) idListTable_.get(key); if (pos != null) { // // Write indirection // out_.write_long(-1); int off = pos.intValue() - buf_.pos_; out_.write_long(off); } else { idListTable_.put(key, new Integer(buf_.pos_)); out_.write_long(ids.length); for (int i = 0; i < ids.length; i++) { // // Add this ID to the history list, if necessary // if (!idTable_.containsKey(ids[i])) idTable_.put(ids[i], new Integer(buf_.pos_)); out_.write_string(ids[i]); } } } else if ((tag & 0x00000006) == 2) { Assert._OB_assert(ids.length == 1); // // Check to see if we've already marshalled this repository ID, // and if so, we write an indirection marker // Integer pos = (Integer) idTable_.get(ids[0]); if (pos != null) { // // Write indirection // out_.write_long(-1); int off = pos.intValue() - buf_.pos_; out_.write_long(off); } else { // // Remember ID in history at current position // idTable_.put(ids[0], new Integer(buf_.pos_)); out_.write_string(ids[0]); } } if (chunked_) { needChunk_ = true; chunkSizePos_ = 0; lastEndTagPos_ = 0; } return startPos; } public void endValue() { if (chunked_) { needChunk_ = false; // // If we haven't written anything since the last end tag, then // this value coterminates with a nested value, so we increment // the last end tag rather than write a new one // if (lastEndTagPos_ > 0 && buf_.pos_ == lastEndTagPos_ + 4) { // // Increment last end tag // lastTag_++; buf_.pos_ = lastEndTagPos_; // same as "buf_.pos_ -= 4;" out_.write_long(lastTag_); } else { endChunk(); // // Write the end tag and remember its position // lastTag_ = -nestingLevel_; out_.write_long(lastTag_); if (nestingLevel_ > 1) lastEndTagPos_ = buf_.pos_ - 4; } // // We're finished chunking if nestingLevel_ == 1 // if (nestingLevel_ == 1) { chunked_ = false; lastEndTagPos_ = 0; lastTag_ = 0; } else { // // We need to start a new chunk // needChunk_ = true; } Assert._OB_assert(chunkSizePos_ == 0); nestingLevel_--; } } public void checkBeginChunk() { if (needChunk_) { needChunk_ = false; // Do this before beginChunk() to // avoid recursion! beginChunk(); } } }
6,224
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Downcall.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import java.util.Vector; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import org.apache.yoko.orb.OCI.GiopVersion; import org.apache.yoko.orb.util.AutoLock; import org.apache.yoko.orb.util.AutoReadWriteLock; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.NO_RESPONSE; import org.omg.IOP.IOR; import org.omg.IOP.ServiceContext; public class Downcall { /** The ORBInstance object */ protected final ORBInstance orbInstance_; private final Logger logger_; // the orbInstance_ logger object /** The client */ private final Client client_; /** The downcall emitter */ private DowncallEmitter emitter_; /** Information about the IOR profile */ protected org.apache.yoko.orb.OCI.ProfileInfo profileInfo_; /** The list of policies */ protected RefCountPolicyList policies_; /** The unique request ID */ private final int reqId_; /** The name of the operation */ protected final String op_; /** Whether a response is expected */ protected final boolean responseExpected_; /** The marshalled headers and parameters */ private org.apache.yoko.orb.CORBA.OutputStream out_; /** Holds the results of the operation */ private org.apache.yoko.orb.CORBA.InputStream in_; /** The state of this invocation */ protected enum State { UNSENT, PENDING, NO_EXCEPTION, USER_EXCEPTION, SYSTEM_EXCEPTION, FAILURE_EXCEPTION, FORWARD, FORWARD_PERM } protected final AutoReadWriteLock stateLock = new AutoReadWriteLock(); protected State state = State.UNSENT; private Condition stateWaitCondition; // // Holds the exception if state_ is DowncallStateUserException, // DowncallStateSystemException, or DowncallStateFailureException // protected Exception ex_; // // Holds the exception ID if state_ is DowncallStateUserException, // DowncallStateSystemException, or DowncallStateFailureException // protected String exId_; // // Holds the forward IOR if state_ is DowncallStateLocationForward // or DowncallLocationForwardPerm // protected IOR forwardIOR_; /** The request and reply service contexts */ protected Vector<ServiceContext> requestSCL_ = new Vector<>(); protected Vector<ServiceContext> replySCL_ = new Vector<>(); // ---------------------------------------------------------------------- // Downcall private and protected member implementations // ---------------------------------------------------------------------- /** Raise an exception if necessary */ void checkForException() throws LocationForward, FailureException { try (AutoLock readLock = stateLock.getReadLock()) { switch (state) { case USER_EXCEPTION: // // Do not raise UserException in Java // // if(ex_ != null) // Only raise if a user exception has been set // throw ex_; break; case SYSTEM_EXCEPTION: Assert._OB_assert(ex_ != null); // update the stack trace to have the caller's stack rather than the // receiver thread. ex_.fillInStackTrace(); throw (org.omg.CORBA.SystemException) ex_; case FAILURE_EXCEPTION: Assert._OB_assert(ex_ != null); throw new FailureException((org.omg.CORBA.SystemException) ex_); case FORWARD: Assert._OB_assert(forwardIOR_ != null); throw new LocationForward(forwardIOR_, false); case FORWARD_PERM: Assert._OB_assert(forwardIOR_ != null); throw new LocationForward(forwardIOR_, true); default: break; } } } /** Required for use by subclasses */ protected final org.apache.yoko.orb.CORBA.OutputStream preMarshalBase() throws LocationForward, FailureException { org.apache.yoko.orb.CORBA.OutputStreamHolder out = new org.apache.yoko.orb.CORBA.OutputStreamHolder(); emitter_ = client_.startDowncall(this, out); out_ = out.value; checkForException(); return out_; } // ---------------------------------------------------------------------- // Downcall public member implementations // ---------------------------------------------------------------------- public Downcall(ORBInstance orbInstance, Client client, org.apache.yoko.orb.OCI.ProfileInfo profileInfo, RefCountPolicyList policies, String op, boolean resp) { orbInstance_ = orbInstance; logger_ = orbInstance_.getLogger(); client_ = client; profileInfo_ = profileInfo; policies_ = policies; op_ = op; responseExpected_ = resp; // since this.state is not volatile we must use a lock to guarantee consistency try (AutoLock writeLock = stateLock.getWriteLock()) { state = State.UNSENT; } ex_ = null; // // Get the next request ID // client.prepareForDowncall(policies); reqId_ = client_.getNewRequestID(); logger_.debug("Downcall created for operation " + op + " with id " + reqId_); } public final ORBInstance orbInstance() { return orbInstance_; } public final Client client() { return client_; } public final org.apache.yoko.orb.OCI.ProfileInfo profileInfo() { return profileInfo_; } public final RefCountPolicyList policies() { return policies_; } public final Exception excep() { return ex_; } public final int requestId() { return reqId_; } public final String operation() { return op_; } public final boolean responseExpected() { return responseExpected_; } public final org.apache.yoko.orb.CORBA.OutputStream output() { return out_; } public final org.apache.yoko.orb.CORBA.InputStream input() { return in_; } public final org.omg.IOP.ServiceContext[] getRequestSCL() { org.omg.IOP.ServiceContext[] scl = new org.omg.IOP.ServiceContext[requestSCL_ .size()]; requestSCL_.copyInto(scl); return scl; } public final void addToRequestSCL(org.omg.IOP.ServiceContext sc) { requestSCL_.addElement(sc); } public final void setReplySCL(org.omg.IOP.ServiceContext[] scl) { // Don't create a new Vector Assert._OB_assert(replySCL_.size() == 0); replySCL_.setSize(scl.length); for (int i = 0; i < scl.length; i++) replySCL_.setElementAt(scl[i], i); } public org.apache.yoko.orb.CORBA.OutputStream preMarshal() throws LocationForward, FailureException { return preMarshalBase(); } public final void marshalEx(org.omg.CORBA.SystemException ex) throws LocationForward, FailureException { setFailureException(ex); checkForException(); Assert._OB_assert(false); } public final void postMarshal() throws LocationForward, FailureException { } public final void locate() throws LocationForward, FailureException { Assert._OB_assert(responseExpected_); Assert._OB_assert(op_.equals("_locate")); // // We could also use send() and receive() separately. But // sendReceive is more efficient // /* * boolean finished = emitter_.send(this, true); if(finished) * checkForException(); * * finished = emitter_.receive(this, true); Assert._OB_assert(finished); * checkForException(); */ boolean finished = emitter_.sendReceive(this); Assert._OB_assert(finished); checkForException(); } public final void request() throws LocationForward, FailureException { Assert._OB_assert(responseExpected_); // // We could also use send() and receive() separately. But using // sendReceive() is more efficient. // /* * boolean finished = emitter_.send(this, true, * policies_.requestTimeout); if(finished) checkForException(); * * finished = emitter_.receive(this, true); Assert._OB_assert(finished); * checkForException(); */ boolean finished = emitter_.sendReceive(this); Assert._OB_assert(finished); checkForException(); } public final void oneway() throws LocationForward, FailureException { Assert._OB_assert(!responseExpected_); if (policies_.syncScope == org.omg.Messaging.SYNC_WITH_TRANSPORT.value) { boolean finished = emitter_.send(this, true); Assert._OB_assert(finished); checkForException(); } else { boolean finished = emitter_.send(this, false); if (finished) checkForException(); } } public final void deferred() throws LocationForward, FailureException { Assert._OB_assert(responseExpected_); boolean finished = emitter_.send(this, true); if (finished) checkForException(); } public final void response() throws LocationForward, FailureException { Assert._OB_assert(responseExpected_); boolean finished = emitter_.receive(this, true); Assert._OB_assert(finished); checkForException(); } public final boolean poll() throws LocationForward, FailureException { Assert._OB_assert(responseExpected_); boolean finished = emitter_.receive(this, false); if (finished) { try (AutoLock lock = stateLock.getReadLock()) { checkForException(); return state != State.PENDING; } } else return false; } public final org.apache.yoko.orb.CORBA.InputStream preUnmarshal() throws LocationForward, FailureException { return in_; } public final void unmarshalEx(org.omg.CORBA.SystemException ex) throws LocationForward, FailureException { setFailureException(ex); checkForException(); Assert._OB_assert(false); } public void postUnmarshal() throws LocationForward, FailureException { // // If the result of this downcall is a user exception, but no user // exception could be unmarshalled, then use the system exception // UNKNOWN // // In Java, the portable stubs only provide the repository ID of // the user exception, so we only want to raise UNKNOWN if we // don't have the ID // try (AutoLock lock = stateLock.getReadLock()) { if (state == State.USER_EXCEPTION && ex_ == null && exId_ == null) setSystemException(new org.omg.CORBA.UNKNOWN(org.apache.yoko.orb.OB.MinorCodes .describeUnknown(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownUserException), org.apache.yoko.orb.OB.MinorCodes.MinorUnknownUserException, org.omg.CORBA.CompletionStatus.COMPLETED_YES)); checkForException(); } } public final String unmarshalExceptionId() { try (AutoLock lock = stateLock.getReadLock()) { Assert._OB_assert(state == State.USER_EXCEPTION); int pos = in_._OB_pos(); String id = in_.read_string(); in_._OB_pos(pos); return id; } } public final boolean unsent() { try (AutoLock lock = stateLock.getReadLock()) { return state == State.UNSENT; } } public final boolean pending() { try (AutoLock lock = stateLock.getReadLock()) { return state == State.PENDING; } } public final boolean noException() { try (AutoLock lock = stateLock.getReadLock()) { return state == State.NO_EXCEPTION; } } public final boolean userException() { try (AutoLock lock = stateLock.getReadLock()) { return state == State.USER_EXCEPTION; } } public final boolean failureException() { try (AutoLock lock = stateLock.getReadLock()) { return state == State.FAILURE_EXCEPTION; } } public final boolean systemException() { try (AutoLock lock = stateLock.getReadLock()) { return state == State.SYSTEM_EXCEPTION; } } public final void setPending() { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(responseExpected_); state = State.PENDING; if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public final void setNoException(org.apache.yoko.orb.CORBA.InputStream in) { try (AutoLock lock = stateLock.getWriteLock()) { state = State.NO_EXCEPTION; if (in == null) { Assert._OB_assert(!responseExpected_); } else { Assert._OB_assert(responseExpected_); in_ = in; in_._OB_ORBInstance(orbInstance_); CodeConverters codeConverters = client_.codeConverters(); in_._OB_codeConverters(codeConverters, GiopVersion.get(profileInfo_.major, profileInfo_.minor)); } if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public final void setUserException(org.apache.yoko.orb.CORBA.InputStream in) { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(in != null); Assert._OB_assert(responseExpected_); state = State.USER_EXCEPTION; in_ = in; in_._OB_ORBInstance(orbInstance_); CodeConverters codeConverters = client_.codeConverters(); in_._OB_codeConverters(codeConverters, GiopVersion.get(profileInfo_.major, profileInfo_.minor)); if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public void setUserException(org.omg.CORBA.UserException ex, String exId) { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(responseExpected_); Assert._OB_assert(ex_ == null); state = State.USER_EXCEPTION; ex_ = ex; if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public final void setUserException(org.omg.CORBA.UserException ex) { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(responseExpected_); Assert._OB_assert(ex_ == null); state = State.USER_EXCEPTION; ex_ = ex; if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public final void setUserException(String exId) { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(responseExpected_); Assert._OB_assert(ex_ == null); state = State.USER_EXCEPTION; exId_ = exId; logger_.debug("Received user exception " + exId); if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public final void setSystemException(org.omg.CORBA.SystemException ex) { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(responseExpected_); Assert._OB_assert(ex_ == null); state = State.SYSTEM_EXCEPTION; ex_ = ex; logger_.debug("Received system exception", ex); if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public final void setFailureException(org.omg.CORBA.SystemException ex) { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(ex_ == null); state = State.FAILURE_EXCEPTION; ex_ = ex; logger_.debug("Received failure exception", ex); if (null != stateWaitCondition) stateWaitCondition.signalAll(); } } public final void setLocationForward(IOR ior, boolean perm) { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(responseExpected_); Assert._OB_assert(forwardIOR_ == null); state = perm ? State.FORWARD_PERM : State.FORWARD; forwardIOR_ = ior; if (null != stateWaitCondition) stateWaitCondition.signalAll(); } Assert._OB_assert(responseExpected_); } // // Initialize the wait condition. This operation must be called in // order to be able to use one of the waitUntil...() operations // below // public final void allowWaiting() { try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(stateWaitCondition == null); stateWaitCondition = lock.newCondition(); } } /** * This operation try waits for a completed state, using the * timeout from this downcall's policies. * * @param block whether to wait for the call to complete * @return true if the call has completed * @throws NO_RESPONSE if a timeout was set and has elapsed */ public final boolean waitUntilCompleted(boolean block) { // // Get the timeout // int t = policies_.requestTimeout; // // Wait for the desired state, taking the timeout and blocking // flag into account // try (AutoLock lock = stateLock.getWriteLock()) { Assert._OB_assert(stateWaitCondition != null); while (state == State.UNSENT || state == State.PENDING) { if (!block) return false; try { if (t <= 0) { stateWaitCondition.await(); } else { State oldState = state; stateWaitCondition.await(t, TimeUnit.MILLISECONDS); if (state == oldState) { throw new NO_RESPONSE("Timeout during receive", 0, CompletionStatus.COMPLETED_MAYBE); } } } catch (InterruptedException ex) { } } if (ex_ instanceof UnresolvedException) ex_ = ((UnresolvedException)ex_).resolve(); // // The downcall has completed // return true; } } }
6,225
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RetryAttributesHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RetryAttributes:1.0 // final public class RetryAttributesHolder implements org.omg.CORBA.portable.Streamable { public RetryAttributes value; public RetryAttributesHolder() { } public RetryAttributesHolder(RetryAttributes initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = RetryAttributesHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { RetryAttributesHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return RetryAttributesHelper.type(); } }
6,226
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Client.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; public abstract class Client { private int usage_; // The usage counter private org.apache.yoko.orb.OB.CodeConverters codeConverters_; // The code // converters // // The concurrency model for this Client // final public static int Blocking = 0; final public static int Threaded = 2; protected int concModel_; // ---------------------------------------------------------------------- // Client private and protected member implementations // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Client package member implementations // ---------------------------------------------------------------------- Client(int concModel, CodeConverters conv) { usage_ = 0; codeConverters_ = conv; concModel_ = concModel; } // ---------------------------------------------------------------------- // Client public member implementations // ---------------------------------------------------------------------- // // Destroy the client // public abstract void destroy(); // // Increment usage (not mutex protected) // public final void incUsage() { Assert._OB_assert(usage_ >= 0); usage_++; } // // Decrement usage (not mutex protected) // // Returns true if after the decrement the usage counter is larger // than 0, and false otherwise. // public final boolean decUsage() { Assert._OB_assert(usage_ > 0); usage_--; return usage_ > 0; } // // Get the codeset converters // public org.apache.yoko.orb.OB.CodeConverters codeConverters() { return codeConverters_; } // // Get a new request ID // public abstract int getNewRequestID(); // // get a list of ServiceContexts that have to be sent on an AMI router // request // public abstract org.omg.IOP.ServiceContext[] getAMIRouterSCL(); // // Get all profiles that are usable with this client // public abstract org.apache.yoko.orb.OCI.ProfileInfo[] getUsableProfiles( org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] pl); // // Get the OCI connector info // public abstract org.apache.yoko.orb.OCI.ConnectorInfo connectorInfo(); // // Get the OCI transport info // public abstract org.apache.yoko.orb.OCI.TransportInfo transportInfo(); // // Start a downcall, returning a downcall emitter and an // OutputStream for marshalling a request // public abstract DowncallEmitter startDowncall(Downcall down, org.apache.yoko.orb.CORBA.OutputStreamHolder out); // // Checks whether this client is equal to another client // public abstract boolean matches(Client clt); // // Force connection establishment // public abstract void bind(int connectTimeout); // // Determines whether this client supports twoway invocations // public abstract boolean twoway(); public void prepareForDowncall(RefCountPolicyList policies) {} }
6,227
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CallStackHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CallStack:1.0 // final public class CallStackHelper { public static void insert(org.omg.CORBA.Any any, String[] val) { org.omg.CORBA.portable.OutputStream out = any.create_output_stream(); write(out, val); any.read_value(out.create_input_stream(), type()); } public static String[] extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return read(any.create_input_stream()); else throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = orb.create_alias_tc(id(), "CallStack", orb.create_sequence_tc(0, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string))); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/CallStack:1.0"; } public static String[] read(org.omg.CORBA.portable.InputStream in) { String[] _ob_v; int len0 = in.read_ulong(); _ob_v = new String[len0]; for(int i0 = 0; i0 < len0; i0++) _ob_v[i0] = in.read_string(); return _ob_v; } public static void write(org.omg.CORBA.portable.OutputStream out, String[] val) { int len0 = val.length; out.write_ulong(len0); for(int i0 = 0; i0 < len0; i0++) out.write_string(val[i0]); } }
6,228
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/THREAD_PER_REQUEST.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/THREAD_PER_REQUEST:1.0 // /** The <code>THREAD_PER_REQUEST</code> DispatchStrategyId. */ public interface THREAD_PER_REQUEST { int value = (int)(1L); }
6,229
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/TimeoutPolicy.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/TimeoutPolicy:1.0 // /** * * The timeout policy. This policy can be used to specify the * default timeout for connection establishment and requests. * If an object also has <code>ConnectionTimeoutPolicy</code> or * <code>RequestTimeoutPolicy</code> set, those values have precedence. * * @see ConnectionTimeoutPolicy * @see RequestTimeoutPolicy * **/ public interface TimeoutPolicy extends TimeoutPolicyOperations, org.omg.CORBA.Policy { }
6,230
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeConverterSimple.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final class CodeConverterSimple extends CodeConverterBase { // ------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------ CodeConverterSimple(CodeSetInfo fromSet, CodeSetInfo toSet) { super(fromSet, toSet); } // ------------------------------------------------------------------ // Public member implementations // ------------------------------------------------------------------ public boolean conversionRequired() { return false; } /* * public char read_wchar(org.apache.yoko.orb.CORBA.InputStream in, int len) { * Assert._OB_assert(false); return (char)0; } * * public void write_wchar(org.apache.yoko.orb.CORBA.OutputStream out, char * v) { Assert._OB_assert(false); } * * public int count_wchar(byte value) { Assert._OB_assert(false); return 0; } * * public int count_wchar(char v) { Assert._OB_assert(false); return 0; } */ public char convert(char v) { Assert._OB_assert(false); return (char) 0; } }
6,231
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchRequest_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.DispatchRequest; final public class DispatchRequest_impl extends org.omg.CORBA.LocalObject implements DispatchRequest { // // The POA // protected org.apache.yoko.orb.OBPortableServer.POA_impl poa_; // // The ObjectId // protected byte[] oid_; // // The Upcall // protected Upcall upcall_; // ------------------------------------------------------------------ // DispatchRequest_impl public member implementation // ------------------------------------------------------------------ public DispatchRequest_impl( org.apache.yoko.orb.OBPortableServer.POA_impl poa, byte[] oid, Upcall upcall) { poa_ = poa; oid_ = oid; upcall_ = upcall; } // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public void invoke() { poa_._OB_dispatch(oid_, upcall_); upcall_ = null; } }
6,232
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Net.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; public final class Net { // // Compare two hosts strings for equality. These don't necessarily // mean they are string comparable... for instance www.cnn.com and // 64.236.24.12 could be the same host // public static boolean CompareHosts(String host1, String host2) { try { java.net.InetAddress addr1 = java.net.InetAddress.getByName(host1); java.net.InetAddress addr2 = java.net.InetAddress.getByName(host2); if (addr1.equals(addr2)) return true; } catch (java.net.UnknownHostException ex) { return false; } return false; } // // Get the "canonical" hostname of the local host. If numeric is // true, the canonical IP address will be returned instead. // public static String getCanonicalHostname(boolean numeric) { String host; try { if (!numeric) { host = java.net.InetAddress.getLocalHost().getHostName(); } else { host = java.net.InetAddress.getLocalHost().getHostAddress(); } if (host.equals("127.0.0.1") || host.equals("localhost")) { } } catch (java.net.UnknownHostException ex) { // logger.warning("ORB_init: " + // "can't resolve hostname\n" + // "using `localhost' (127.0.0.1) " + // "instead of hostname"); if (numeric) host = "127.0.0.1"; else host = "localhost"; } return host; } }
6,233
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/InvalidThreadPoolHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/InvalidThreadPool:1.0 // final public class InvalidThreadPoolHolder implements org.omg.CORBA.portable.Streamable { public InvalidThreadPool value; public InvalidThreadPoolHolder() { } public InvalidThreadPoolHolder(InvalidThreadPool initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = InvalidThreadPoolHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { InvalidThreadPoolHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return InvalidThreadPoolHelper.type(); } }
6,234
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPServerStarter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OCI.Acceptor; import java.util.Vector; import java.util.logging.Logger; abstract class GIOPServerStarter { static final Logger logger = Logger.getLogger(GIOPServerStarter.class.getName()); protected final ORBInstance orbInstance_; // The ORBInstance protected final Acceptor acceptor_; // The acceptor protected final OAInterface oaInterface_; // The OA interface protected final Vector connections_ = new java.util.Vector(); // Workers public static final int StateActive = 0; public static final int StateHolding = 1; public static final int StateClosed = 2; protected int state_; // ---------------------------------------------------------------------- // GIOPServer private and protected member implementation // ---------------------------------------------------------------------- protected void finalize() throws Throwable { Assert._OB_assert(state_ == StateClosed); super.finalize(); } // // Emit a trace message when closing the acceptor // protected void logCloseAcceptor() { CoreTraceLevels coreTraceLevels = orbInstance_.getCoreTraceLevels(); if (coreTraceLevels.traceConnections() > 0) { org.apache.yoko.orb.OCI.AcceptorInfo info = acceptor_.get_info(); String msg = "stopped accepting connections\n"; msg += info.describe(); orbInstance_.getLogger().trace("incoming", msg); } } protected void reapWorkers() { for (int i = 0; i < connections_.size();) { GIOPConnection connection = (GIOPConnection) connections_.elementAt(i); if (connection.destroyed()) connections_.removeElementAt(i); else ++i; } } // ---------------------------------------------------------------------- // GIOPServer public member implementation // ---------------------------------------------------------------------- GIOPServerStarter(ORBInstance orbInstance, org.apache.yoko.orb.OCI.Acceptor acceptor, OAInterface oaInterface) { orbInstance_ = orbInstance; acceptor_ = acceptor; oaInterface_ = oaInterface; state_ = StateHolding; // Must be holding initially try { // // Trace acceptor creation // CoreTraceLevels coreTraceLevels = orbInstance_.getCoreTraceLevels(); if (coreTraceLevels.traceConnections() > 0) { org.apache.yoko.orb.OCI.AcceptorInfo info = acceptor_ .get_info(); String msg = "accepting connections\n"; msg += info.describe(); orbInstance_.getLogger().trace("incoming", msg); } // // Start listening // acceptor_.listen(); } catch (org.omg.CORBA.SystemException ex) { acceptor_.close(); state_ = StateClosed; throw ex; } } // // given a host/port this will search the workers of this // GIOPServerStarter for an inbound connection transport // which matches the specific connection information. // It returns null if not found. // public synchronized GIOPConnection getMatchingConnection(org.apache.yoko.orb.OCI.ConnectorInfo connInfo) { // // reap the workers first since we don't want to return a // destroyed transport // reapWorkers(); // // iterate the workers // for (int i = 0; i < connections_.size(); i++) { GIOPConnection worker = (GIOPConnection) connections_.elementAt(i); // we only want to find inbound connections if (worker.isOutbound()) continue; org.apache.yoko.orb.OCI.Transport transport = worker.transport(); if (transport != null && transport.get_info().endpoint_alias_match(connInfo)) return worker; } // // we never found a match for the transport // return null; } // // Change the state of the worker // abstract public void setState(int state); }
6,235
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CONNECTION_REUSE_POLICY_ID.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CONNECTION_REUSE_POLICY_ID:1.0 // /** * * This policy type identifies the connection reuse policy. * **/ public interface CONNECTION_REUSE_POLICY_ID { int value = (int)(1330577411L); }
6,236
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/URLRegistryHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/URLRegistry:1.0 // final public class URLRegistryHelper { public static void insert(org.omg.CORBA.Any any, URLRegistry val) { any.insert_Object(val, type()); } public static URLRegistry extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "URLRegistry"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/URLRegistry:1.0"; } public static URLRegistry read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, URLRegistry val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static URLRegistry narrow(org.omg.CORBA.Object val) { try { return (URLRegistry)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,237
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ProtocolPolicyHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ProtocolPolicy:1.0 // final public class ProtocolPolicyHolder implements org.omg.CORBA.portable.Streamable { public ProtocolPolicy value; public ProtocolPolicyHolder() { } public ProtocolPolicyHolder(ProtocolPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = ProtocolPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { ProtocolPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return ProtocolPolicyHelper.type(); } }
6,238
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CharMapDatabaseInit.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final class CharMapDatabaseInit { static int charMapInfoArraySize_ = 8; static short[] mappingInfoValues0 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; static short[] mappingInfoValues1 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 }; static short[] mappingInfoValues2 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B, 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C, 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 }; static short[] mappingInfoValues3 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9 }; static short[] mappingInfoValues4 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F }; static short[] mappingInfoValues5 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x2018, 0x2019, 0x00A3, 0x0000, 0x0000, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x0000, 0x2015, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE }; static short[] mappingInfoValues6 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF }; static short[] mappingInfoValues7 = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E }; static CharMapInfo[] charMapInfoArray_ = new CharMapInfo[8]; CharMapDatabaseInit() { charMapInfoArray_[0] = new CharMapInfo( "ISO/IEC 8859-1:1998 to Unicode", 0xFF, mappingInfoValues0); charMapInfoArray_[1] = new CharMapInfo("ISO 8859-2:1999 to Unicode", 0xFF, mappingInfoValues1); charMapInfoArray_[2] = new CharMapInfo( "ISO/IEC 8859-3:1999 to Unicode", 0xFF, mappingInfoValues2); charMapInfoArray_[3] = new CharMapInfo( "ISO/IEC 8859-4:1998 to Unicode", 0xFF, mappingInfoValues3); charMapInfoArray_[4] = new CharMapInfo("ISO 8859-5:1999 to Unicode", 0xFF, mappingInfoValues4); charMapInfoArray_[5] = new CharMapInfo("ISO 8859-7:1987 to Unicode", 0xFE, mappingInfoValues5); charMapInfoArray_[6] = new CharMapInfo( "ISO/IEC 8859-9:1999 to Unicode", 0xFF, mappingInfoValues6); charMapInfoArray_[7] = new CharMapInfo("PCS to Unicode", 0x7E, mappingInfoValues7); } }
6,239
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectionReusePolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.CONNECTION_REUSE_POLICY_ID; import org.apache.yoko.orb.OB.ConnectionReusePolicy; final public class ConnectionReusePolicy_impl extends org.omg.CORBA.LocalObject implements ConnectionReusePolicy { private boolean value_; // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public boolean value() { return value_; } public int policy_type() { return CONNECTION_REUSE_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ public ConnectionReusePolicy_impl(boolean r) { value_ = r; } }
6,240
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocProtocolHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CorbalocProtocol:1.0 // final public class CorbalocProtocolHolder implements org.omg.CORBA.portable.Streamable { public CorbalocProtocol value; public CorbalocProtocolHolder() { } public CorbalocProtocolHolder(CorbalocProtocol initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = CorbalocProtocolHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { CorbalocProtocolHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return CorbalocProtocolHelper.type(); } }
6,241
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PolicyFactoryManager.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; public final class PolicyFactoryManager { private boolean destroy_; // True if destroy() was called // // These are PolicyFactory objects that are registered from the PIManager // java.util.Hashtable policyFactoryTableExternal_ = new java.util.Hashtable( 63); // // These are PolicyFactory objects that are registered internally // (for ORB policies, etc) // java.util.Hashtable policyFactoryTableInternal_ = new java.util.Hashtable( 63); // ---------------------------------------------------------------------- // PolicyFactoryManager private and protected member implementations // ---------------------------------------------------------------------- void destroy() { Assert._OB_assert(!destroy_); destroy_ = true; policyFactoryTableInternal_.clear(); policyFactoryTableExternal_.clear(); } // ---------------------------------------------------------------------- // PolicyFactoryManager public member implementations // ---------------------------------------------------------------------- public void registerPolicyFactory(int type, org.omg.PortableInterceptor.PolicyFactory factory, boolean internal) { // // TODO: some sensible error // java.util.Hashtable table = (internal) ? policyFactoryTableInternal_ : policyFactoryTableExternal_; Integer itype = new Integer(type); if (table.containsKey(itype)) throw new org.omg.CORBA.BAD_PARAM(); table.put(itype, factory); } public org.omg.CORBA.Policy createPolicy(int type, org.omg.CORBA.Any any) throws org.omg.CORBA.PolicyError { java.lang.Object factory; Integer itype = new Integer(type); if ((factory = policyFactoryTableInternal_.get(itype)) != null) return ((org.omg.PortableInterceptor.PolicyFactory) factory) .create_policy(type, any); if ((factory = policyFactoryTableExternal_.get(itype)) != null) return ((org.omg.PortableInterceptor.PolicyFactory) factory) .create_policy(type, any); throw new org.omg.CORBA.PolicyError(org.omg.CORBA.BAD_POLICY.value); } public void filterPolicyList(org.omg.CORBA.PolicyListHolder in, org.omg.CORBA.PolicyListHolder out) { java.util.Vector inVec = new java.util.Vector(); for (int i = 0; i < in.value.length; i++) inVec.addElement(in.value[i]); java.util.Vector outVec = new java.util.Vector(); for (int i = 0; i < out.value.length; i++) outVec.addElement(out.value[i]); for (int policy = 0; policy < inVec.size(); policy++) { org.omg.CORBA.Policy p = (org.omg.CORBA.Policy) inVec .elementAt(policy); int type = p.policy_type(); java.util.Enumeration e = policyFactoryTableExternal_.keys(); while (e.hasMoreElements()) { Integer key = (Integer) e.nextElement(); if (key.intValue() == type) { outVec.addElement(p); inVec.removeElementAt(policy); --policy; break; } } } if (inVec.size() != in.value.length) { in.value = new org.omg.CORBA.Policy[inVec.size()]; inVec.copyInto(in.value); } if (outVec.size() != out.value.length) { out.value = new org.omg.CORBA.Policy[outVec.size()]; outVec.copyInto(out.value); } } /** * Test if a policy type is valid for the current * context. * * @param type The policy type number. * * @return true if the policy is a registered type, false for * unknown types. */ public boolean isPolicyRegistered(int type) { Integer itype = new Integer(type); return policyFactoryTableInternal_.containsKey(itype) || policyFactoryTableExternal_.containsKey(itype); } }
6,242
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Util.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.osgi.ProviderLocator; import org.omg.IOP.ServiceContext; import org.omg.SendingContext.CodeBase; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.logging.Logger; public final class Util { static final Logger logger = Logger.getLogger(Util.class.getName()); // // Print octets to stream // public static void printOctets(java.io.PrintStream out, byte[] oct, int offset, int length) { final int inc = 8; for (int i = offset; i < offset + length; i += inc) { for (int j = i; j - i < inc; j++) { if (j < offset + length) { int n = (int) oct[j]; if (n < 0) n += 256; String s; if (n < 10) s = " " + n; else if (n < 100) s = " " + n; else s = "" + n; out.print(s + " "); } else out.print(" "); } out.print('"'); for (int j = i; j < offset + length && j - i < inc; j++) { if (oct[j] >= (byte) 32 && oct[j] < (byte) 127) out.print((char) oct[j]); else out.print('.'); } out.println('"'); } } // // Copy a system exception // public static org.omg.CORBA.SystemException copySystemException( org.omg.CORBA.SystemException ex) { org.omg.CORBA.SystemException result = null; try { Class c = ex.getClass(); Class[] paramTypes = { String.class }; java.lang.reflect.Constructor constr = c.getConstructor(paramTypes); Object[] initArgs = { ex.getMessage() }; result = (org.omg.CORBA.SystemException) constr .newInstance(initArgs); result.minor = ex.minor; result.completed = ex.completed; } catch (NoSuchMethodException e) { Assert._OB_assert(ex); } catch (InstantiationException e) { Assert._OB_assert(ex); } catch (IllegalAccessException e) { Assert._OB_assert(ex); } catch (IllegalArgumentException e) { Assert._OB_assert(ex); } catch (java.lang.reflect.InvocationTargetException e) { Assert._OB_assert(ex); } return result; } // // Unmarshal a system exception // public static org.omg.CORBA.SystemException unmarshalSystemException( org.omg.CORBA.portable.InputStream in) { String id = in.read_string(); int minor = in.read_ulong(); org.omg.CORBA.CompletionStatus status = org.omg.CORBA.CompletionStatus .from_int(in.read_ulong()); if (id.equals("IDL:omg.org/CORBA/BAD_PARAM:1.0")) { String reason = MinorCodes.describeBadParam(minor); return new org.omg.CORBA.BAD_PARAM(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/NO_MEMORY:1.0")) { String reason = MinorCodes.describeNoMemory(minor); return new org.omg.CORBA.NO_MEMORY(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/IMP_LIMIT:1.0")) { String reason = MinorCodes.describeImpLimit(minor); return new org.omg.CORBA.IMP_LIMIT(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/COMM_FAILURE:1.0")) { String reason = MinorCodes.describeCommFailure(minor); return new org.omg.CORBA.COMM_FAILURE(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/INV_OBJREF:1.0")) { return new org.omg.CORBA.INV_OBJREF(minor, status); } else if (id.equals("IDL:omg.org/CORBA/NO_PERMISSION:1.0")) { return new org.omg.CORBA.NO_PERMISSION(minor, status); } else if (id.equals("IDL:omg.org/CORBA/INTERNAL:1.0")) { return new org.omg.CORBA.INTERNAL(minor, status); } else if (id.equals("IDL:omg.org/CORBA/MARSHAL:1.0")) { String reason = MinorCodes.describeMarshal(minor); return new org.omg.CORBA.MARSHAL(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/INITIALIZE:1.0")) { String reason = MinorCodes.describeInitialize(minor); return new org.omg.CORBA.INITIALIZE(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/NO_IMPLEMENT:1.0")) { String reason = MinorCodes.describeNoImplement(minor); return new org.omg.CORBA.NO_IMPLEMENT(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/BAD_TYPECODE:1.0")) { return new org.omg.CORBA.BAD_TYPECODE(minor, status); } else if (id.equals("IDL:omg.org/CORBA/BAD_OPERATION:1.0")) { return new org.omg.CORBA.BAD_OPERATION(minor, status); } else if (id.equals("IDL:omg.org/CORBA/NO_RESOURCES:1.0")) { String reason = MinorCodes.describeNoResources(minor); return new org.omg.CORBA.NO_RESOURCES(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/NO_RESPONSE:1.0")) { return new org.omg.CORBA.NO_RESPONSE(minor, status); } else if (id.equals("IDL:omg.org/CORBA/PERSIST_STORE:1.0")) { return new org.omg.CORBA.PERSIST_STORE(minor, status); } else if (id.equals("IDL:omg.org/CORBA/BAD_INV_ORDER:1.0")) { String reason = MinorCodes.describeBadInvOrder(minor); return new org.omg.CORBA.BAD_INV_ORDER(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/TRANSIENT:1.0")) { String reason = MinorCodes.describeTransient(minor); return new org.omg.CORBA.TRANSIENT(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/FREE_MEM:1.0")) { return new org.omg.CORBA.FREE_MEM(minor, status); } else if (id.equals("IDL:omg.org/CORBA/INV_IDENT:1.0")) { return new org.omg.CORBA.INV_IDENT(minor, status); } else if (id.equals("IDL:omg.org/CORBA/INV_FLAG:1.0")) { return new org.omg.CORBA.INV_FLAG(minor, status); } else if (id.equals("IDL:omg.org/CORBA/INTF_REPOS:1.0")) { String reason = MinorCodes.describeIntfRepos(minor); return new org.omg.CORBA.INTF_REPOS(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/BAD_CONTEXT:1.0")) { return new org.omg.CORBA.BAD_CONTEXT(minor, status); } else if (id.equals("IDL:omg.org/CORBA/OBJ_ADAPTER:1.0")) { return new org.omg.CORBA.OBJ_ADAPTER(minor, status); } else if (id.equals("IDL:omg.org/CORBA/DATA_CONVERSION:1.0")) { return new org.omg.CORBA.DATA_CONVERSION(minor, status); } else if (id.equals("IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0")) { String reason = MinorCodes.describeObjectNotExist(minor); return new org.omg.CORBA.OBJECT_NOT_EXIST(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/TRANSACTION_REQUIRED:1.0")) { return new org.omg.CORBA.TRANSACTION_REQUIRED(minor, status); } else if (id.equals("IDL:omg.org/CORBA/TRANSACTION_ROLLEDBACK:1.0")) { return new org.omg.CORBA.TRANSACTION_ROLLEDBACK(minor, status); } else if (id.equals("IDL:omg.org/CORBA/INVALID_TRANSACTION:1.0")) { return new org.omg.CORBA.INVALID_TRANSACTION(minor, status); } else if (id.equals("IDL:omg.org/CORBA/INV_POLICY:1.0")) { String reason = MinorCodes.describeInvPolicy(minor); return new org.omg.CORBA.INV_POLICY(reason, minor, status); } else if (id.equals("IDL:omg.org/CORBA/CODESET_INCOMPATIBLE:1.0")) { return new org.omg.CORBA.CODESET_INCOMPATIBLE(minor, status); } else if (id.equals("IDL:omg.org/CORBA/REBIND:1.0")) { return new org.omg.CORBA.REBIND(minor, status); } else if (id.equals("IDL:omg.org/CORBA/TIMEOUT:1.0")) { return new org.omg.CORBA.TIMEOUT(minor, status); } else if (id.equals("IDL:omg.org/CORBA/TRANSACTION_UNAVAILABLE:1.0")) { return new org.omg.CORBA.TRANSACTION_UNAVAILABLE(minor, status); } else if (id.equals("IDL:omg.org/CORBA/TRANSACTION_MODE:1.0")) { return new org.omg.CORBA.TRANSACTION_MODE(minor, status); } else if (id.equals("IDL:omg.org/CORBA/BAD_QOS:1.0")) { return new org.omg.CORBA.BAD_QOS(minor, status); } // // Unknown exception // String reason = MinorCodes.describeUnknown(minor); return new org.omg.CORBA.UNKNOWN(reason, minor, status); } // // Marshal a system exception // public static void marshalSystemException( org.omg.CORBA.portable.OutputStream out, org.omg.CORBA.SystemException ex) { out.write_string(getExceptionId(ex)); out.write_ulong(ex.minor); out.write_ulong(ex.completed.value()); } private static String[] sysExClassNames_ = { "org.omg.CORBA.BAD_CONTEXT", "org.omg.CORBA.BAD_INV_ORDER", "org.omg.CORBA.BAD_OPERATION", "org.omg.CORBA.BAD_PARAM", "org.omg.CORBA.BAD_QOS", "org.omg.CORBA.BAD_TYPECODE", "org.omg.CORBA.CODESET_INCOMPATIBLE", "org.omg.CORBA.COMM_FAILURE", "org.omg.CORBA.DATA_CONVERSION", "org.omg.CORBA.FREE_MEM", "org.omg.CORBA.IMP_LIMIT", "org.omg.CORBA.INITIALIZE", "org.omg.CORBA.INTERNAL", "org.omg.CORBA.INTF_REPOS", "org.omg.CORBA.INVALID_TRANSACTION", "org.omg.CORBA.INV_FLAG", "org.omg.CORBA.INV_IDENT", "org.omg.CORBA.INV_OBJREF", "org.omg.CORBA.INV_POLICY", "org.omg.CORBA.MARSHAL", "org.omg.CORBA.NO_IMPLEMENT", "org.omg.CORBA.NO_MEMORY", "org.omg.CORBA.NO_PERMISSION", "org.omg.CORBA.NO_RESOURCES", "org.omg.CORBA.NO_RESPONSE", "org.omg.CORBA.OBJECT_NOT_EXIST", "org.omg.CORBA.OBJ_ADAPTER", "org.omg.CORBA.PERSIST_STORE", "org.omg.CORBA.REBIND", "org.omg.CORBA.TIMEOUT", "org.omg.CORBA.TRANSACTION_MODE", "org.omg.CORBA.TRANSACTION_REQUIRED", "org.omg.CORBA.TRANSACTION_ROLLEDBACK", "org.omg.CORBA.TRANSACTION_UNAVAILABLE", "org.omg.CORBA.TRANSIENT", "org.omg.CORBA.UNKNOWN" }; private static String[] sysExIds_ = { "IDL:omg.org/CORBA/BAD_CONTEXT:1.0", "IDL:omg.org/CORBA/BAD_INV_ORDER:1.0", "IDL:omg.org/CORBA/BAD_OPERATION:1.0", "IDL:omg.org/CORBA/BAD_PARAM:1.0", "IDL:omg.org/CORBA/BAD_QOS:1.0", "IDL:omg.org/CORBA/BAD_TYPECODE:1.0", "IDL:omg.org/CORBA/CODESET_INCOMPATIBLE:1.0", "IDL:omg.org/CORBA/COMM_FAILURE:1.0", "IDL:omg.org/CORBA/DATA_CONVERSION:1.0", "IDL:omg.org/CORBA/FREE_MEM:1.0", "IDL:omg.org/CORBA/IMP_LIMIT:1.0", "IDL:omg.org/CORBA/INITIALIZE:1.0", "IDL:omg.org/CORBA/INTERNAL:1.0", "IDL:omg.org/CORBA/INTF_REPOS:1.0", "IDL:omg.org/CORBA/INVALID_TRANSACTION:1.0", "IDL:omg.org/CORBA/INV_FLAG:1.0", "IDL:omg.org/CORBA/INV_IDENT:1.0", "IDL:omg.org/CORBA/INV_OBJREF:1.0", "IDL:omg.org/CORBA/INV_POLICY:1.0", "IDL:omg.org/CORBA/MARSHAL:1.0", "IDL:omg.org/CORBA/NO_IMPLEMENT:1.0", "IDL:omg.org/CORBA/NO_MEMORY:1.0", "IDL:omg.org/CORBA/NO_PERMISSION:1.0", "IDL:omg.org/CORBA/NO_RESOURCES:1.0", "IDL:omg.org/CORBA/NO_RESPONSE:1.0", "IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0", "IDL:omg.org/CORBA/OBJ_ADAPTER:1.0", "IDL:omg.org/CORBA/PERSIST_STORE:1.0", "IDL:omg.org/CORBA/REBIND:1.0", "IDL:omg.org/CORBA/TIMEOUT:1.0", "IDL:omg.org/CORBA/TRANSACTION_MODE:1.0", "IDL:omg.org/CORBA/TRANSACTION_REQUIRED:1.0", "IDL:omg.org/CORBA/TRANSACTION_ROLLEDBACK:1.0", "IDL:omg.org/CORBA/TRANSACTION_UNAVAILABLE:1.0", "IDL:omg.org/CORBA/TRANSIENT:1.0", "IDL:omg.org/CORBA/UNKNOWN:1.0" }; private static int binarySearch(String[] arr, String value) { int left = 0; int right = arr.length; int index = -1; while (left < right) { int m = (left + right) / 2; int res = arr[m].compareTo(value); if (res == 0) { index = m; break; } else if (res > 0) right = m; else left = m + 1; } return index; } // // Determine if the repository ID represents a system exception // public static boolean isSystemException(String id) { return (binarySearch(sysExIds_, id) != -1); } // // Determine the repository ID of an exception // public static String getExceptionId(Exception ex) { if (ex instanceof org.omg.CORBA.SystemException) { String className = ex.getClass().getName(); int index = binarySearch(sysExClassNames_, className); if (index == -1) return "IDL:omg.org/CORBA/UNKNOWN:1.0"; else return sysExIds_[index]; } else if (ex instanceof org.omg.CORBA.UserException) { Class exClass = ex.getClass(); String className = exClass.getName(); String id = null; try { Class c = ProviderLocator.loadClass(className + "Helper", exClass, null); java.lang.reflect.Method m = c.getMethod("id", new Class[0]); id = (String) m.invoke(null, new Object[0]); } catch (ClassNotFoundException e) { } catch (NoSuchMethodException e) { Assert._OB_assert(ex); } catch (IllegalAccessException e) { Assert._OB_assert(ex); } catch (IllegalArgumentException e) { Assert._OB_assert(ex); } catch (java.lang.reflect.InvocationTargetException e) { Assert._OB_assert(ex); } catch (SecurityException e) { } // // TODO: Is this correct? // if (id == null) return "IDL:omg.org/CORBA/UserException:1.0"; else return id; } else { Assert._OB_assert(ex); return null; // needed by compiler } } public static void insertException(org.omg.CORBA.Any any, java.lang.Exception ex) { // // Find the helper class for the exception and use it to insert // the exception into the any // try { Class exClass = ex.getClass(); String helper = exClass.getName() + "Helper"; // get the appropriate class for the loading. Class c = ProviderLocator.loadClass(helper, exClass, Thread.currentThread().getContextClassLoader()); final Class[] paramTypes = { org.omg.CORBA.Any.class, exClass }; java.lang.reflect.Method m = c.getMethod("insert", paramTypes); final java.lang.Object[] args = { any, ex }; m.invoke(null, args); } catch (ClassNotFoundException e) { } catch (NoSuchMethodException e) { Assert._OB_assert(ex); } catch (IllegalAccessException e) { Assert._OB_assert(ex); } catch (IllegalArgumentException e) { Assert._OB_assert(ex); } catch (java.lang.reflect.InvocationTargetException e) { Assert._OB_assert(ex); } catch (SecurityException e) { } } static ClassLoader getContextClassLoader () { if (System.getSecurityManager() == null) { return Thread.currentThread ().getContextClassLoader (); } else { return (ClassLoader) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return Thread.currentThread ().getContextClassLoader (); } }); } } public static CodeBase getSendingContextRuntime(ORBInstance orbInstance_, ServiceContext[] scl) { for(int i = 0 ; i < scl.length ; i++) { if(scl[i].context_id == org.omg.IOP.SendingContextRunTime.value) { return new CodeBaseProxy(orbInstance_, scl[i]); } } return null; } }
6,243
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RetryPolicyHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RetryPolicy:1.0 // final public class RetryPolicyHolder implements org.omg.CORBA.portable.Streamable { public RetryPolicy value; public RetryPolicyHolder() { } public RetryPolicyHolder(RetryPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = RetryPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { RetryPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return RetryPolicyHelper.type(); } }
6,244
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootLocatorHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/BootLocator:1.0 // final public class BootLocatorHolder implements org.omg.CORBA.portable.Streamable { public BootLocator value; public BootLocatorHolder() { } public BootLocatorHolder(BootLocator initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = BootLocatorHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { BootLocatorHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return BootLocatorHelper.type(); } }
6,245
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchRequest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/DispatchRequest:1.0 // /** * * This interface encaspulates a request. * * @see DispatchStrategy * **/ public interface DispatchRequest extends DispatchRequestOperations, org.omg.CORBA.Object { }
6,246
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueReader.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import java.io.Serializable; import java.lang.reflect.Array; import java.util.Hashtable; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.rmi.CORBA.ValueHandler; import org.apache.yoko.orb.CORBA.InputStream; import org.apache.yoko.orb.CORBA.OutputStream; import org.apache.yoko.orb.OCI.Buffer; import org.apache.yoko.util.cmsf.RepIds; import org.omg.CORBA.Any; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.CustomMarshal; import org.omg.CORBA.DataInputStream; import org.omg.CORBA.MARSHAL; import org.omg.CORBA.StringHolder; import org.omg.CORBA.SystemException; import org.omg.CORBA.TCKind; import org.omg.CORBA.TypeCode; import org.omg.CORBA.TypeCodePackage.BadKind; import org.omg.CORBA.TypeCodePackage.Bounds; import org.omg.CORBA.VM_CUSTOM; import org.omg.CORBA.VM_NONE; import org.omg.CORBA.VM_TRUNCATABLE; import org.omg.CORBA.WStringValueHelper; import org.omg.CORBA.portable.BoxedValueHelper; import org.omg.CORBA.portable.IndirectionException; import org.omg.CORBA.portable.StreamableValue; import org.omg.CORBA.portable.ValueFactory; import org.omg.SendingContext.CodeBase; public final class ValueReader { private static final Logger logger = Logger.getLogger(ValueReader.class.getName()); // // Chunk data // private static class ChunkState { boolean chunked; int nestingLevel; int chunkStart; int chunkSize; ChunkState() { } ChunkState(ChunkState s) { copyFrom(s); } void copyFrom(ChunkState s) { chunked = s.chunked; nestingLevel = s.nestingLevel; chunkStart = s.chunkStart; chunkSize = s.chunkSize; } } // // Valuetype header data // private static class Header { int tag; int headerPos; int dataPos; String[] ids; final ChunkState state; Header next; // Java only String codebase; // Java only Header() { ids = new String[0]; state = new ChunkState(); } boolean isRMIValue() { return (ids != null) && (ids.length > 0) && ids[0].startsWith("RMI:"); } } private final ORBInstance orbInstance_; private final InputStream in_; private final Buffer buf_; private final Map<Integer, Serializable> instanceTable_; private final Map<Integer, Header> headerTable_; private Map<Integer, Integer> positionTable_; private final ChunkState chunkState_ = new ChunkState(); private Header currentHeader_; private ValueHandler valueHandler; private CodeBase remoteCodeBase; // ------------------------------------------------------------------ // Valuetype creation strategies // ------------------------------------------------------------------ private abstract static class CreationStrategy { final ValueReader reader_; final InputStream is_; CreationStrategy(ValueReader reader, InputStream is) { reader_ = reader; is_ = is; } abstract Serializable create(Header h); } // // Create a valuebox using a BoxedValueHelper // private static class BoxCreationStrategy extends CreationStrategy { private final BoxedValueHelper helper_; BoxCreationStrategy(ValueReader reader, InputStream is, BoxedValueHelper helper) { super(reader, is); helper_ = helper; } Serializable create(Header h) { Assert._OB_assert((h.tag >= 0x7fffff00) && (h.tag != -1)); final Serializable result = helper_.read_value(is_); if (result != null) { reader_.addInstance(h.headerPos, result); return result; } throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorNoValueFactory) + ": " + helper_.get_id(), MinorCodes.MinorNoValueFactory, CompletionStatus.COMPLETED_NO); } } // // Create a value using a class // private static class ClassCreationStrategy extends CreationStrategy { private final Class<? extends Serializable> clz_; ClassCreationStrategy(ValueReader reader, InputStream is, Class<? extends Serializable> clz) { super(reader, is); clz_ = clz; } Serializable create(Header h) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Creating a value object with tag value 0x%08x", h.tag)); Assert._OB_assert((h.tag >= 0x7fffff00) && (h.tag != -1)); if (h.isRMIValue()) { return reader_.readRMIValue(h, clz_, h.ids[0]); } try { Serializable result = clz_.newInstance(); reader_.addInstance(h.headerPos, result); try { reader_.unmarshalValueState(result); } catch (SystemException ex) { reader_.removeInstance(h.headerPos); throw ex; } return result; } catch (ClassCastException | InstantiationException | IllegalAccessException ignored) { } throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorNoValueFactory) + ": " + clz_.getName(), MinorCodes.MinorNoValueFactory, CompletionStatus.COMPLETED_NO); } } // // Create a value using a factory // private class FactoryCreationStrategy extends CreationStrategy { private final String id_; private final ORBInstance orbInstance_; FactoryCreationStrategy(ValueReader reader, InputStream is, String id) { super(reader, is); id_ = id; orbInstance_ = is._OB_ORBInstance(); } private ValueFactory findFactory(Header h, StringHolder id) { ValueFactory f = null; if (orbInstance_ != null) { final ValueFactoryManager manager = orbInstance_.getValueFactoryManager(); if (h.ids.length > 0) { for (int i = 0; i < h.ids.length; i++) { f = manager.lookupValueFactoryWithClass(h.ids[i]); if (f != null) { id.value = h.ids[i]; break; } // // If we have a formal ID, and we haven't found // a factory yet, then give up // if ((id_ != null) && h.ids[i].equals(id_)) { break; } } } else if (id_ != null) { f = manager.lookupValueFactoryWithClass(id_); id.value = id_; } } return f; } private Serializable createWithFactory(Header h, ValueFactory factory) { // // The factory's read_value method is expected to create // an instance of the valuetype and then call the method // InputStream.read_value(java.io.Serializable) to read // the valuetype state. We use a stack to remember the // Header information for use by initializeValue(), which // is called by read_value(). // try { reader_.pushHeader(h); return factory.read_value(is_); } finally { reader_.popHeader(); } } private BoxedValueHelper getBoxedHelper(String id) { if (WStringValueHelper.id().equals(id)) return new WStringValueHelper(); final Class helperClass = RepIds.query(id).suffix("Helper").toClass(); if (helperClass != null) { try { return (BoxedValueHelper) helperClass.newInstance(); } catch (ClassCastException | InstantiationException | IllegalAccessException ignored) { } throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorNoValueFactory) + ": invalid BoxedValueHelper for " + id, MinorCodes.MinorNoValueFactory, CompletionStatus.COMPLETED_NO); } return null; } Serializable create(Header h) { final StringHolder idH = new StringHolder(); return create(h, idH); } Serializable create(Header h, StringHolder id) { Assert._OB_assert((h.tag >= 0x7fffff00) && (h.tag != -1)); if (h.isRMIValue()) { final Serializable result = readRMIValue(h, null, h.ids[0]); addInstance(h.headerPos, result); return result; } // // See if a factory exists that can create the value // final ValueFactory factory = findFactory(h, id); if (factory != null) { final Serializable result = createWithFactory(h, factory); reader_.addInstance(h.headerPos, result); return result; } // // Another possibility is that we're unmarshalling a valuebox, // so we'll try to load the Helper class dynamically // BoxedValueHelper helper = null; if (h.ids.length > 0) { // // If it's a valuebox, at most one id will be marshalled // helper = getBoxedHelper(h.ids[0]); if (helper != null) { id.value = h.ids[0]; } } if ((helper == null) && (id_ != null)) { helper = getBoxedHelper(id_); if (helper != null) { id.value = id_; } } if (helper != null) { final Serializable result = helper.read_value(is_); reader_.addInstance(h.headerPos, result); return result; } String type = "<unknown>"; if (h.ids.length > 0) { type = h.ids[0]; } else if (id_ != null) { type = id_; } throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorNoValueFactory) + ": " + type, MinorCodes.MinorNoValueFactory, CompletionStatus.COMPLETED_NO); } } // ------------------------------------------------------------------ // Private and protected members // ------------------------------------------------------------------ // Java only private void addInstance(int pos, Serializable instance) { // only add this if we have a real value if (instance != null) { instanceTable_.put(pos, instance); } } // Java only private void removeInstance(int pos) { instanceTable_.remove(pos); } private void readHeader(Header h) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Reading header with tag value 0x%08x at pos=0x%x", h.tag, in_.buf_.pos_)); // // Special cases are handled elsewhere // Assert._OB_assert((h.tag != 0) && (h.tag != -1)); // // Check if the value is chunked // if ((h.tag & 0x00000008) == 8) { h.state.chunked = true; } else { h.state.chunked = false; } // // Check for presence of codebase URL // if ((h.tag & 0x00000001) == 1) { // // Check for indirection tag // final int save = buf_.pos_; final int indTag = in_.read_long(); if (indTag == -1) { final int offs = in_.read_long(); if (offs >= -4) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } final int tmp = buf_.pos_; buf_.pos_ = (buf_.pos_ - 4) + offs; if (buf_.pos_ < 0) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } h.codebase = in_.read_string(); buf_.pos_ = tmp; } else { buf_.pos_ = save; h.codebase = in_.read_string(); } if (logger.isLoggable(Level.FINER)) logger.finer(String.format("Value header codebase value is \"%s\"", h.codebase)); } // // Extract repository ID information // if ((h.tag & 0x00000006) == 0) { logger.finer("No type information was included"); // // No type information was marshalled // } else if ((h.tag & 0x00000006) == 6) { logger.finer("Multiple types included in header"); // // Extract a list of repository IDs, representing the // truncatable types for this value // // // Check for indirection tag (indirected list) // int saveList = buf_.pos_; int indTag = in_.read_long(); final boolean indList = (indTag == -1); if (indList) { final int offs = in_.read_long(); if (offs > -4) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } saveList = buf_.pos_; buf_.pos_ = (buf_.pos_ - 4) + offs; if (buf_.pos_ < 0) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } } else { buf_.pos_ = saveList; } final int count = in_.read_long(); h.ids = new String[count]; for (int i = 0; i < count; i++) { // // Check for indirection tag (indirected list entry) // int saveRep = buf_.pos_; indTag = in_.read_long(); if (indTag == -1) { final int offs = in_.read_long(); if (offs > -4) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } saveRep = buf_.pos_; buf_.pos_ = (buf_.pos_ - 4) + offs; if (buf_.pos_ < 0) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } h.ids[i] = in_.read_string(); buf_.pos_ = saveRep; } else { buf_.pos_ = saveRep; h.ids[i] = in_.read_string(); } if (logger.isLoggable(Level.FINER)) logger.finer(String.format("Value header respoitory id added \"%s\"", h.ids[i])); } // // Restore buffer position (case of indirected list) // if (indList) { buf_.pos_ = saveList; } } else if ((h.tag & 0x00000006) == 2) { // // Extract a single repository ID // final String id; // // Check for indirection tag // int save = buf_.pos_; final int indTag = in_.read_long(); if (indTag == -1) { final int offs = in_.read_long(); if (offs > -4) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } save = buf_.pos_; buf_.pos_ = (buf_.pos_ - 4) + offs; if (buf_.pos_ < 0) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorReadInvalidIndirection), MinorCodes.MinorReadInvalidIndirection, CompletionStatus.COMPLETED_NO); } id = in_.read_string(); buf_.pos_ = save; } else { buf_.pos_ = save; id = in_.read_string(); } h.ids = new String[1]; h.ids[0] = id; if (logger.isLoggable(Level.FINER)) logger.finer(String.format("Single header repository id read \"%s\"", id)); } // // Record beginning of value data // h.dataPos = buf_.pos_; // // Add entry to header table // headerTable_.put(h.headerPos, h); } private void readChunk(ChunkState state) { // // Check for a chunk size // final int size = in_._OB_readLongUnchecked(); if (logger.isLoggable(Level.FINEST)) logger.finest(String.format( "Reading new chunk. Size value is 0x%x current nest is %d current position=0x%x", size, state.nestingLevel, buf_.pos_)); if ((size >= 0) && (size < 0x7fffff00)) // chunk size { state.chunkStart = buf_.pos_; state.chunkSize = size; } else if (size < 0) // end tag { buf_.pos_ -= 4; // rewind state.chunkStart = buf_.pos_; state.chunkSize = 0; } else { buf_.pos_ -= 4; // rewind state.chunkStart = 0; state.chunkSize = 0; } if (logger.isLoggable(Level.FINEST)) logger.finest(String.format("Chunk read. start=0x%x, size=0x%x buffer position=0x%x", state.chunkStart, state.chunkSize, buf_.pos_)); } private void initHeader(Header h) { // // Null values and indirections must be handled by caller // Assert._OB_assert((h.tag != 0) && (h.tag != -1)); h.headerPos = buf_.pos_ - 4; // adjust for alignment h.state.copyFrom(chunkState_); // // Read value header info // readHeader(h); chunkState_.copyFrom(h.state); // // Increment our nesting level if we are chunked // if (chunkState_.chunked) { // logger.finest("Reading chunk for chunked value. Header tag=" + Integer.toHexString(h.tag) + " current position=" + buf_.pos_); readChunk(chunkState_); chunkState_.nestingLevel++; // logger.fine("Chunk nesting level is " + chunkState_.nestingLevel + " current position=" + buf_.pos_ + " chunk size=" + chunkState_.chunkSize); } } private void skipChunk() { if (chunkState_.chunked) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Skipping a chunked value. nesting level=%d current position is 0x%x chunk end is 0x%x", chunkState_.nestingLevel, buf_.pos_, (chunkState_.chunkStart + chunkState_.chunkSize))); // // At this point, the unmarshalling code has finished. However, // we may have a truncated value, or we may have unmarshalled a // custom value. In either case, we can't be sure that the // unmarshalling code has positioned the stream at the end of // this value. // // Therefore we will advance, chunk by chunk, until we reach // the end of the value. // // // Skip to the end of the current chunk (if necessary) // if (chunkState_.chunkStart > 0) { buf_.pos_ = chunkState_.chunkStart; in_._OB_skip(chunkState_.chunkSize); if (logger.isLoggable(Level.FINEST)) logger.finest(String.format("Skipping to end of current chunk. New position is 0x%x", buf_.pos_)); } chunkState_.chunkStart = 0; chunkState_.chunkSize = 0; // // Loop until we have reached the end of this value. We may // have to process nested values, chunks, etc. // int level = chunkState_.nestingLevel; int tag = in_._OB_readLongUnchecked(); if (logger.isLoggable(Level.FINEST)) logger.finest(String.format("Skipping chunk: read tag value =0x%08x", tag)); while ((tag >= 0) || ((tag < 0) && (tag < -chunkState_.nestingLevel))) { if (tag >= 0x7fffff00) { logger.finest("Skipping chunk: reading a nested chunk value"); // // This indicates a nested value. We read the header // information and store it away, in case a subsequent // indirection refers to this value. // level++; final Header nest = new Header(); nest.tag = tag; nest.headerPos = buf_.pos_ - 4; // adjust for alignment nest.state.nestingLevel = level; readHeader(nest); } else if (tag >= 0) { if (logger.isLoggable(Level.FINEST)) logger.finest(String.format("Skipping chunk: skipping over a chunk for length 0x%x", tag)); // // Chunk size - advance the stream past the chunk // in_._OB_skip(tag); } else { if (logger.isLoggable(Level.FINEST)) logger.finest(String.format("Skipping chunk: chunk end tag=0x%08x current level=%d", tag, level)); // // tag is less than 0, so this is an end tag for a nested // value // // this can terminate more than a single level. level = (-tag) - 1; } // // Read the next tag // tag = in_._OB_readLongUnchecked(); if (logger.isLoggable(Level.FINEST)) logger.finest(String.format("Skipping chunk: read tag value=0x%08x", tag)); } // // If the tag is greater than our nesting level, then this // value coterminates with an outer value. We rewind the // stream so that the outer value can read this tag. // if (tag > -chunkState_.nestingLevel) { buf_.pos_ -= 4; } chunkState_.nestingLevel--; if (logger.isLoggable(Level.FINEST)) logger.finest(String.format("New chunk nesting level is %d", chunkState_.nestingLevel)); if (chunkState_.nestingLevel == 0) { chunkState_.chunked = false; } else { // // We're chunked and still processing nested values, so // another chunk may follow // logger.finest("Reading chunk for skipping to end of a chunk"); readChunk(chunkState_); } if (logger.isLoggable(Level.FINEST)) logger.finest(String.format( "Final chunk state is nesting level=%d current position is 0x%x chunk end is 0x%x", chunkState_.nestingLevel, buf_.pos_, (chunkState_.chunkStart + chunkState_.chunkSize))); } } // // Invoke the valuetype to unmarshal its state // // Java only // private void unmarshalValueState(Serializable v) { if (v instanceof StreamableValue) { ((StreamableValue) v)._read(in_); } else if (v instanceof CustomMarshal) { final DataInputStream dis = new org.apache.yoko.orb.CORBA.DataInputStream(in_); ((CustomMarshal) v).unmarshal(dis); } else { throw new MARSHAL("Valuetype does not implement " + "StreamableValue or " + "CustomMarshal"); } } private Serializable readIndirection(CreationStrategy strategy) { final int offs = in_.read_long(); int pos = (buf_.pos_ - 4) + offs; pos += 3; // adjust for alignment pos -= (pos & 0x3); final Integer posObj = pos; // // Check the history for a value that was seen at the specified // position. Generally, we should expect the value to be present. // However, in the case of chunking, it's possible for an // indirection to refer to a nested value in the truncated state // of an enclosing value, or to a value that we could not // instantiate. // Serializable v = (Serializable) instanceTable_.get(posObj); if (v != null) { return v; } else { final int save = buf_.pos_; // // Check for indirection to null value // buf_.pos_ = pos; // rewind to offset position if (in_._OB_readLongUnchecked() == 0) { buf_.pos_ = save; // Can't put a null in a Hashtable // instanceTable_.put(posObj, null); return null; } // // If it's not null and it's not in our history, then // there's no hope // final Header nest = headerTable_.get(posObj); if (nest == null) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorNoValueFactory) + ": cannot instantiate value for indirection", MinorCodes.MinorNoValueFactory, CompletionStatus.COMPLETED_NO); } /* * Maybe we have an indirection to an object that is being * deserialized. We throw an IndirectionException which signals the * RMI implementation to handle the indirection. */ if (nest.isRMIValue()) { buf_.pos_ = save; throw new IndirectionException(pos); } // // Create the value // buf_.pos_ = nest.dataPos; final ChunkState saveState = new ChunkState(chunkState_); chunkState_.copyFrom(nest.state); if (chunkState_.chunked) { readChunk(chunkState_); } try { v = strategy.create(nest); } finally { // // Restore state // buf_.pos_ = save; chunkState_.copyFrom(saveState); } return v; } } private java.io.Serializable read(CreationStrategy strategy) { Header h = new Header(); h.tag = in_.read_long(); // logger.fine("Read tag value " + Integer.toHexString(h.tag)); if (h.tag == 0) { return null; } else if (h.tag == -1) { return readIndirection(strategy); } else if (h.tag < 0x7fffff00) { throw new org.omg.CORBA.MARSHAL(String.format( "Illegal valuetype tag 0x%08x", h.tag)); } else { initHeader(h); // read_value() may be called to skip over a secondary custom valuetype. // If so, return an internal marker object so it shows up if misused. final Serializable result = isSecondaryCustomValuetype(h) ? SecondaryValuetypeMarker.ATTEMPT_TO_READ_CUSTOM_DATA_AS_VALUE : strategy.create(h); skipChunk(); return result; } } private enum SecondaryValuetypeMarker { ATTEMPT_TO_READ_CUSTOM_DATA_AS_VALUE } private boolean isSecondaryCustomValuetype(Header h) { // there must be exactly one repository ID if (h.ids.length != 1) return false; // the repository ID must start with one of the Java-to-IDL spec prefixes final String repId = h.ids[0]; if (!(repId.startsWith("RMI:org.omg.custom.") || repId.startsWith("RMI:org.omg.customRMI."))) return false; // it matched enough of the rules, so treat it as a secondary custom valuetype // there should not be a codebase (tolerate but log this) if (h.codebase != null) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format( "Secondary custom marshal valuetype found with non-null codebase: \"%s\", repId: \"%s\"", h.codebase, repId)); } return true; } // // Remarshal each valuetype member // private void copyValueState(TypeCode tc, OutputStream out) { try { if (tc.kind() == TCKind.tk_value) { // // First copy the state of the concrete base type, if any // final TypeCode base = tc.concrete_base_type(); if (base != null) { copyValueState(base, out); } for (int i = 0; i < tc.member_count(); i++) { // logger.fine("writing member of typecode " + tc.member_type(i).kind().value()); out.write_InputStream(in_, tc.member_type(i)); } } else if (tc.kind() == TCKind.tk_value_box) { out.write_InputStream(in_, tc.content_type()); } else { Assert._OB_assert(false); } } catch (BadKind | Bounds ex) { logger.log(Level.FINER, "Invalid type kind", ex); Assert._OB_assert(ex); } } // Java only private void pushHeader(Header h) { h.next = currentHeader_; currentHeader_ = h; } // Java only private void popHeader() { Assert._OB_assert(currentHeader_ != null); currentHeader_ = currentHeader_.next; } // // Search up the valuetype's inheritance hierarchy for a TypeCode // with the given repository ID // private TypeCode findTypeCode(String id, TypeCode tc) { TypeCode result = null; TypeCode t = tc; // logger.finer("Locating type code for id " + id); while (result == null) { try { final TypeCode t2 = org.apache.yoko.orb.CORBA.TypeCode._OB_getOrigType(t); // logger.finer("Checking typecode " + id + " against " + t2.id()); if (id.equals(t2.id())) { result = t; } else if ((t2.kind() == TCKind.tk_value) && (t2.type_modifier() == VM_TRUNCATABLE.value)) { t = t2.concrete_base_type(); // logger.finer("Iterating with concrete type " + t.id()); } else { break; } } catch (BadKind ex) { Assert._OB_assert(ex); } } return result; } // ------------------------------------------------------------------ // Public methods // ------------------------------------------------------------------ public ValueReader(InputStream in) { in_ = in; buf_ = in._OB_buffer(); orbInstance_ = in._OB_ORBInstance(); instanceTable_ = new Hashtable<Integer, Serializable>(131); headerTable_ = new Hashtable<Integer, Header>(131); } private Serializable readRMIValue(Header h, Class<? extends Serializable> clz, String repid) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Reading RMI value of type \"%s\"", repid)); if (valueHandler == null) { valueHandler = javax.rmi.CORBA.Util.createValueHandler(); } if (repid == null) { repid = h.ids[0]; if (repid == null) { throw new MARSHAL("missing repository id"); } } final String className = RepIds.query(repid).toClassName(); String codebase = h.codebase; if (codebase == null) { codebase = in_.__getCodeBase(); } Class repoClass = resolveRepoClass(className, codebase); // if we have a non-null codebase and can't resolve this, throw an // exception now. Otherwise, we'll try again after grabbing the remote // codebase. if ((repoClass == null) && (codebase != null) && !codebase.isEmpty()) { throw new MARSHAL("class " + className + " not found (cannot load from " + codebase + ")"); } if (remoteCodeBase == null) { remoteCodeBase = in_.__getSendingContextRuntime(); } if (repoClass == null) { if ((codebase == null) && (remoteCodeBase != null)) { try { codebase = remoteCodeBase.implementation(repid); } catch (SystemException ignored) { } } if (codebase == null) { // TODO: add minor code throw new MARSHAL("class " + className + " not found (no codebase provided)"); } else { repoClass = resolveRepoClass(className, codebase); if (repoClass == null) { throw new MARSHAL("class " + className + " not found (cannot load from " + codebase + ")"); } } } /* * Suns crappy ValueHandler implementation narrows the remote CodeBase * to a com.sun.org.omg.SendingContext.CodeBase. Narrowing CodeBaseProxy * is not possible, we need a stub. */ if (remoteCodeBase instanceof CodeBaseProxy) { remoteCodeBase = ((CodeBaseProxy) remoteCodeBase).getCodeBase(); } Serializable serobj = null; try { serobj = valueHandler.readValue(in_, h.headerPos, repoClass, repid, remoteCodeBase); } catch (RuntimeException ex) { if (logger.isLoggable(Level.FINE)) { logger.fine(String.format( "RuntimeException happens when reading GIOP stream coming to pos_=0x%x", in_.buf_.pos_)); logger.fine(String.format("Wrong data section:%n%s", in_.dumpData())); final int currentpos = in_.buf_.pos_; in_.buf_.pos_ = 0; logger.fine(String.format("Full GIOP stream dump:%n%s", in_.dumpData())); in_.buf_.pos_ = currentpos; } throw ex; } return serobj; } private Class resolveRepoClass(String name, String codebase) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format( "Attempting to resolve class \"%s\" from codebase \"%s\"", name, codebase)); if (name.startsWith("[")) { int levels = 0; for (int i = 0; name.charAt(i) == '['; i++) { levels++; } Class elementClass = null; // now resolve the element descriptor to a class switch (name.charAt(levels)) { case 'Z': elementClass = Boolean.TYPE; break; case 'B': elementClass = Byte.TYPE; break; case 'S': elementClass = Short.TYPE; break; case 'C': elementClass = Character.TYPE; break; case 'I': elementClass = Integer.TYPE; break; case 'J': elementClass = Long.TYPE; break; case 'F': elementClass = Float.TYPE; break; case 'D': elementClass = Double.TYPE; break; case 'L': // extract the class from the name and resolve that. elementClass = resolveRepoClass(name.substring(levels + 1, name.indexOf(';')), codebase); if (elementClass == null) { return null; } break; } // ok, we need to recurse and resolve the base array element class Object arrayInstance; // this is easier with a single level if (levels == 1) { arrayInstance = Array.newInstance(elementClass, 0); } else { // all elements will be zero final int[] dimensions = new int[levels]; arrayInstance = Array.newInstance(elementClass, dimensions); } // return the class associated with this array return arrayInstance.getClass(); } else { try { return javax.rmi.CORBA.Util.loadClass(name, codebase, Util.getContextClassLoader()); } catch (ClassNotFoundException ex) { // this will be sorted out later return null; } } } public Serializable readValue() { final FactoryCreationStrategy strategy = new FactoryCreationStrategy(this, in_, null); return read(strategy); } public Serializable readValue(String id) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Reading value of type \"%s\"", id)); final FactoryCreationStrategy strategy = new FactoryCreationStrategy(this, in_, id); return read(strategy); } public Serializable readValue(Class<? extends Serializable> clz) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Reading value of type \"%s\"", clz.getName())); if (clz.equals(String.class)) { return WStringValueHelper.read(in_); } final ClassCreationStrategy strategy = new ClassCreationStrategy(this, in_, clz); Serializable result; try { result = read(strategy); } catch (MARSHAL marshalex) { logger.severe(String.format("MARSHAL \"%s\", at pos=0x%x", marshalex.getMessage(), (in_.buf_.pos_ - 4))); if ("true".equalsIgnoreCase(System.getProperty("org.apache.yoko.ignoreInvalidValueTag"))) { result = read(strategy); } else { throw marshalex; } } return result; } public Serializable readValueBox(BoxedValueHelper helper) { final BoxCreationStrategy strategy = new BoxCreationStrategy(this, in_, helper); return read(strategy); } public void initializeValue(Serializable value) { // // We should have previously pushed a Header on the stack // Assert._OB_assert(currentHeader_ != null); // // Now that we have an instance, we can put it in our history // addInstance(currentHeader_.headerPos, value); // // Unmarshal the value's state // try { unmarshalValueState(value); } catch (SystemException ex) { removeInstance(currentHeader_.headerPos); throw ex; } } public Object readAbstractInterface() { // // Abstract interfaces are marshalled like a union with a // boolean discriminator - if true, an objref follows, // otherwise a valuetype follows // if (in_.read_boolean()) { return in_.read_Object(); } else { return readValue(); } } public Object readAbstractInterface(Class clz) { // // Abstract interfaces are marshalled like a union with a // boolean discriminator - if true, an objref follows, // otherwise a valuetype follows // if (in_.read_boolean()) { return in_.read_Object(clz); } else { return readValue(clz); } } // // Copy a value from out InputStream to the given OutputStream. // The return value is the most-derived TypeCode of the value // written to the stream. This may not be the same as the TypeCode // argument if the value is truncated. Furthermore, the TypeCode // may not represent the actual most-derived type, since a more-derived // value may have been read. // public TypeCode remarshalValue(TypeCode tc, OutputStream out) { // // TODO: We've removed the reset of the position table at each top // level call. We need to perform more testing and analysis to verify // that this wasn't broken. remarshalDepth was also removed since it // wasn't being used anywhere except to determine when the table should // be reset. // // // Create a new Hashtable for each top-level call to remarshalValue // if (positionTable_ == null) { positionTable_ = new Hashtable<Integer, Integer>(131); } final TypeCode origTC = org.apache.yoko.orb.CORBA.TypeCode._OB_getOrigType(tc); final Header h = new Header(); h.tag = in_.read_long(); if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Read tag value 0x%08x", h.tag)); h.headerPos = buf_.pos_ - 4; // adjust for alignment h.state.copyFrom(chunkState_); // // Remember starting position of this valuetype // final int pos = h.headerPos; // // Check for special cases (null values and indirections) // TypeCode result; if (h.tag == 0) { out.write_long(0); result = tc; } else if (h.tag == -1) { // // Since offsets can change as we remarshal valuetypes to the // output stream, we use a table to map old positions to new ones // int offs = in_.read_long(); int oldPos = (buf_.pos_ - 4) + offs; oldPos += 3; // adjust alignment to start of value oldPos -= (oldPos & 0x3); // // If we find the position in the table, write the translated // offset to the output stream. Otherwise, the indirection refers // to a valuetype that we were unable to create and we therefore // raise MARSHAL. // @SuppressWarnings("UnnecessaryBoxing") final Integer newPos = positionTable_.get(oldPos); if (newPos != null) { out.write_long(h.tag); offs = newPos - out._OB_pos(); out.write_long(offs); // // TODO: The TypeCode may not necessarily reflect the // TypeCode of the indirected value. // result = tc; } else { throw new MARSHAL("Cannot find value for indirection"); } } else { if (h.tag < 0x7fffff00) { throw new MARSHAL("Illegal valuetype tag 0x" + Integer.toHexString(h.tag)); } if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Remarshalling header with tag value 0x%08x", h.tag)); // // Add valuetype to position map // int outPos = out._OB_pos(); outPos += 3; // adjust alignment to start of value outPos -= (outPos & 0x3); positionTable_.put(pos, outPos); // // Read value header info // readHeader(h); chunkState_.copyFrom(h.state); if (chunkState_.chunked) { logger.finest("Reading chunk in remarshal value()"); readChunk(chunkState_); chunkState_.nestingLevel++; } String tcId = null; short mod = VM_NONE.value; try { tcId = origTC.id(); if (origTC.kind() == TCKind.tk_value) { mod = origTC.type_modifier(); } } catch (BadKind ex) { Assert._OB_assert(ex); } // // We have two methods of extracting the state of a valuetype: // // 1) Use the TypeCode // 2) Use a valuetype factory // // Which method we use is determined by the repository IDs // in the valuetype header. // // Our goal is to preserve as much information as possible. // If the TypeCode describes a more-derived type than any // available factory, we will use the TypeCode. Otherwise, // we use a factory to create a temporary instance of the // valuetype, and subsequently marshal that instance to the // OutputStream. // if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Attempting to resolve typeId \"%s\"", tcId)); // // See if the TypeCode ID matches any of the valuetype's IDs - // stop at the first match // String id = null; int idPos; for (idPos = 0; idPos < h.ids.length; idPos++) { if (logger.isLoggable(Level.FINER)) logger.finer(String.format( "Comparing type id \"%s\" against \"%s\"", tcId, h.ids[idPos])); if (tcId.equals(h.ids[idPos])) { id = h.ids[idPos]; break; } } // if this is null, then try again to see if we can find a class in the ids list // that is compatible with the base type. This will require resolving the classes. if (id == null) { // see if we can resolve the type for the stored type code final Class<?> baseType = RepIds.query(tcId).toClass(); if (baseType != null) { for (idPos = 0; idPos < h.ids.length; idPos++) { if (logger.isLoggable(Level.FINER)) logger.finer(String.format( "Considering base types of id \"%s\" against \"%s\"", tcId, h.ids[idPos])); final Class idType = RepIds.query(h.ids[idPos]).toClass(); if (idType != null) { // if these classes are assignment compatible, go with that as the type. if (logger.isLoggable(Level.FINER)) logger.finer(String.format( "Comparing type id \"%s\" against \"%s\"", baseType.getName(), idType.getName())); if (baseType.isAssignableFrom(idType)) { id = h.ids[idPos]; break; } } } } } // // See if a factory exists for any of the valuetype's IDs - // stop at the first match // String factoryId = null; int factoryPos = 0; ValueFactory factory = null; if (orbInstance_ != null) { final ValueFactoryManager manager = orbInstance_.getValueFactoryManager(); for (factoryPos = 0; factoryPos < h.ids.length; factoryPos++) { factory = manager.lookupValueFactoryWithClass(h.ids[factoryPos]); if (factory != null) { factoryId = h.ids[factoryPos]; break; } } } // // If no ID matched the TypeCode, and no factory was found, // then we have no way to remarshal the data // if ((h.ids.length > 0) && (id == null) && (factoryId == null)) { if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Unable to resolve a factory for type \"%s\"", tcId)); throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorNoValueFactory) + ": insufficient information to copy valuetype", MinorCodes.MinorNoValueFactory, CompletionStatus.COMPLETED_NO); } // // If value is custom and there is no factory, then we have // no way to remarshal the data // if ((mod == VM_CUSTOM.value) && (factoryId == null)) { throw new MARSHAL(MinorCodes.describeMarshal(MinorCodes.MinorNoValueFactory) + ": unable to copy custom valuetype", MinorCodes.MinorNoValueFactory, CompletionStatus.COMPLETED_NO); } // // If the TypeCode is more descriptive than any available // factory, or if no identifiers were provided, then use the // TypeCode, otherwise use the factory // // NOTE: (Java only) We also use the TypeCode for boxed values, // because we don't have the BoxedHelper and may not be // able to locate one via the class loader. // if ((idPos < factoryPos) || (h.ids.length == 0) || (origTC.kind() == TCKind.tk_value_box)) { // // We may need to truncate the state of this value, which // means we need to revise the list of repository IDs // final int numIds = h.ids.length - idPos; final String[] ids = new String[numIds]; System.arraycopy(h.ids, idPos, ids, idPos - idPos, h.ids.length - idPos); logger.fine("Copying value state of object using truncated type"); out._OB_beginValue(h.tag, ids, h.state.chunked); copyValueState(origTC, out); out._OB_endValue(); result = tc; } else { // // Create a temporary instance to use for marshalling // try { pushHeader(h); final Serializable vb = factory.read_value(in_); logger.fine("Creating a temporary copy of the object for marshalling"); try { out.write_value(vb); } finally { removeInstance(h.headerPos); } } finally { popHeader(); } // // Determine the TypeCode that is equivalent to the // factory in use // result = findTypeCode(h.ids[factoryPos], tc); if (result == null) { result = tc; } } skipChunk(); } Assert._OB_assert(result != null); return result; } public void readValueAny(Any any, TypeCode tc) { // // In constrast to other complex types, valuetypes and value boxes // in Anys cannot simply be "remarshalled". The reason is that // indirection may occur across multiple Any values in the same // stream. Therefore, if possible, we should attempt to construct // the values using a factory so that any shared values will be // handled correctly. // // If a factory cannot be found, we should still remarshal. // However, if an indirection is encountered which refers to // a value we were unable to construct, an exception will be // raised. // org.apache.yoko.orb.CORBA.Any obAny = null; try { obAny = (org.apache.yoko.orb.CORBA.Any) any; } catch (ClassCastException ex) { // // Any may have been created by a foreign ORB // } final TypeCode origTC = org.apache.yoko.orb.CORBA.TypeCode._OB_getOrigType(tc); if (logger.isLoggable(Level.FINE)) logger.fine(String.format( "Reading an Any value of kind=%d from position 0x%x", origTC.kind().value(), buf_.pos_)); // // Check if the Any contains an abstract interface // if (origTC.kind() == TCKind.tk_abstract_interface) { final boolean b = in_.read_boolean(); if (b) { logger.fine("Reading an object reference for an abstract interface"); // // The abstract interface represents an object reference // any.insert_Object(in_.read_Object(), tc); return; } else { logger.fine("Reading an object value for an abstract interface"); // // The abstract interface represents a valuetype. The // readValue() method will raise an exception if an // instance of the valuetype could not be created. // We cannot remarshal in this case because we don't // have a TypeCode for the valuetype. // any.insert_Value(readValue(), tc); return; } } // // If the TypeCode's repository ID is that of CORBA::ValueBase, // then we try to create an instance. The Any could contain a // valuetype *or* a boxed valuetype. // // If creation fails, we cannot remarshal the value, since // CORBA::ValueBase is not a truncatable base type, and we // have no other TypeCode information. Truncating to // CORBA::ValueBase doesn't seem very useful anyway. // try { final String id = origTC.id(); if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Reading an Any value of id=\"%s\"", id)); if ("IDL:omg.org/CORBA/ValueBase:1.0".equals(id)) { any.insert_Value(readValue(), tc); return; } } catch (BadKind ex) { Assert._OB_assert(ex); } // // At this point, the Any contains a valuetype or a boxed valuetype, // and we have a TypeCode that can be used for remarshalling. // // // Save some state so that we can restore things prior to // remarshalling // final int startPos = buf_.pos_; final ChunkState startState = new ChunkState(chunkState_); // // No need to worry about truncation for boxed valuetypes // if (origTC.kind() == TCKind.tk_value_box) { try { any.insert_Value(readValue(tc.id()), tc); return; } catch (MARSHAL ex) { // // Creation failed - restore our state and try remarshalling // buf_.pos_ = startPos; chunkState_.copyFrom(startState); final Buffer buf = new Buffer(); final OutputStream out = new OutputStream(buf); out._OB_ORBInstance(orbInstance_); remarshalValue(origTC, out); final InputStream in = (InputStream) out.create_input_stream(); Assert._OB_assert(obAny != null); obAny.replace(tc, in); return; } catch (BadKind ex) { Assert._OB_assert(ex); } } else { // // Read valuetype header tag // final Header h = new Header(); h.tag = in_.read_long(); if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Read tag value 0x%08x", h.tag)); // // Check tag for special cases // if (h.tag == 0) { any.insert_Value(null, tc); return; } if ((h.tag != -1) && (h.tag < 0x7fffff00)) { throw new MARSHAL("Illegal valuetype tag 0x" + Integer.toHexString(h.tag)); } // // Try to create an instance of the valuetype using a factory // final FactoryCreationStrategy strategy = new FactoryCreationStrategy(this, in_, null); try { if (h.tag == -1) { // // TODO: The TypeCode may not necessarily reflect // the one that was used for the indirected value // (i.e., the value may have been truncated). // Fixing this probably requires maintaining a // map of stream position to TypeCode. // logger.fine("Handling a value type indirection value"); any.insert_Value(readIndirection(strategy), tc); return; } else { initHeader(h); final StringHolder idH = new StringHolder(); final Serializable vb = strategy.create(h, idH); if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Obtained a value of type \"%s\"", vb.getClass().getName())); skipChunk(); // // Find the TypeCode for the repository ID that was // used to instantiate the valuetype. Three things // can happen: // // 1) The TypeCode is equal to tc. // // 2) The TypeCode is null. In this case, the instance // is of a more-derived type than tc, so the best // we can do is to use tc. // // 3) The TypeCode is a base type of tc. In this case, // the valuetype was truncated. // TypeCode t = null; if (idH.value != null) { t = findTypeCode(idH.value, tc); } if (t != null) { any.insert_Value(vb, t); } else { any.insert_Value(vb, tc); } return; } } catch (MARSHAL ex) { logger.log(Level.FINE, "Marshaling exception occurred, attempting to remarshal", ex); // // Creation failed - restore our state and try remarshalling // buf_.pos_ = startPos; chunkState_.copyFrom(startState); final Buffer buf = new Buffer(); final OutputStream out = new OutputStream(buf); out._OB_ORBInstance(orbInstance_); final TypeCode t = remarshalValue(origTC, out); final InputStream in = (InputStream) out.create_input_stream(); Assert._OB_assert(obAny != null); obAny.replace(t, in); return; } } Assert._OB_assert(false); // should never reach this point } public void beginValue() { final Header h = new Header(); h.tag = in_.read_long(); if (logger.isLoggable(Level.FINE)) logger.fine(String.format("Read tag value 0x%08x", h.tag)); Assert._OB_assert((h.tag != 0) && (h.tag != -1)); initHeader(h); } public void endValue() { skipChunk(); } public void checkChunk() { if (!chunkState_.chunked) { return; } // logger.finest("Checking chunk position. end=" + (chunkState_.chunkStart + chunkState_.chunkSize) + " buffer position=" + buf_.pos_); // // If we've reached the end of the current chunk, then check // for the start of a new chunk // if ((chunkState_.chunkStart > 0) && ((chunkState_.chunkStart + chunkState_.chunkSize) == buf_.pos_)) { // logger.finest("Reading chunk from check chunk"); readChunk(chunkState_); } } }
6,247
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnsentMessage.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; public final class UnsentMessage { public org.apache.yoko.orb.OCI.Buffer buf; public Downcall down; UnsentMessage(org.apache.yoko.orb.OCI.Buffer buf) { this.buf = buf; this.buf.pos(0); } UnsentMessage(Downcall down) { this.down = down; this.buf = down.output()._OB_buffer(); this.buf.pos(0); } }
6,248
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ZeroPortPolicyValue.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ZeroPortPolicyValue:1.0 // /***/ public class ZeroPortPolicyValue implements org.omg.CORBA.portable.IDLEntity { private boolean value_; public final static boolean _ZERO_PORT = true; public final static ZeroPortPolicyValue ZERO_PORT = new ZeroPortPolicyValue(_ZERO_PORT); public final static boolean _NONZERO_PORT = false; public final static ZeroPortPolicyValue NONZERO_PORT = new ZeroPortPolicyValue(_NONZERO_PORT); protected ZeroPortPolicyValue(boolean value) { value_ = value; } public boolean value() { return value_; } public static ZeroPortPolicyValue from_boolean(boolean value) { if (value) { return ZERO_PORT; } else { return NONZERO_PORT; } } private java.lang.Object readResolve() throws java.io.ObjectStreamException { return from_boolean(value()); } }
6,249
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/THREAD_POOL.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/THREAD_POOL:1.0 // /** The <code>THREAD_POOL</code> DispatchStrategyId. */ public interface THREAD_POOL { int value = (int)(2L); }
6,250
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocURLSchemeHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CorbalocURLScheme:1.0 // final public class CorbalocURLSchemeHelper { public static void insert(org.omg.CORBA.Any any, CorbalocURLScheme val) { any.insert_Object(val, type()); } public static CorbalocURLScheme extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "CorbalocURLScheme"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/CorbalocURLScheme:1.0"; } public static CorbalocURLScheme read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, CorbalocURLScheme val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static CorbalocURLScheme narrow(org.omg.CORBA.Object val) { try { return (CorbalocURLScheme)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,251
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RETRY_ALWAYS.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RETRY_ALWAYS:1.0 // /** * * The <code>RETRY_ALWAYS</code> RetryPolicy value. * **/ public interface RETRY_ALWAYS { short value = (short)(2L); }
6,252
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/FailureException.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final public class FailureException extends Exception { // // The system exception causing the failure // public org.omg.CORBA.SystemException exception; public FailureException() { } public FailureException(org.omg.CORBA.SystemException ex) { exception = ex; } }
6,253
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocURLSchemeHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CorbalocURLScheme:1.0 // final public class CorbalocURLSchemeHolder implements org.omg.CORBA.portable.Streamable { public CorbalocURLScheme value; public CorbalocURLSchemeHolder() { } public CorbalocURLSchemeHolder(CorbalocURLScheme initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = CorbalocURLSchemeHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { CorbalocURLSchemeHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return CorbalocURLSchemeHelper.type(); } }
6,254
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RetryPolicyHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RetryPolicy:1.0 // final public class RetryPolicyHelper { public static void insert(org.omg.CORBA.Any any, RetryPolicy val) { any.insert_Object(val, type()); } public static RetryPolicy extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "RetryPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/RetryPolicy:1.0"; } public static RetryPolicy read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, RetryPolicy val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static RetryPolicy narrow(org.omg.CORBA.Object val) { try { return (RetryPolicy)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,255
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootLocatorHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/BootLocator:1.0 // final public class BootLocatorHelper { public static void insert(org.omg.CORBA.Any any, BootLocator val) { any.insert_Object(val, type()); } public static BootLocator extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "BootLocator"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/BootLocator:1.0"; } public static BootLocator read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, BootLocator val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static BootLocator narrow(org.omg.CORBA.Object val) { try { return (BootLocator)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,256
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionStrategy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.Logger; import org.apache.yoko.orb.OB.UnknownExceptionInfo; import org.apache.yoko.orb.OB.UnknownExceptionStrategy; // // An UnknownExceptionStrategy will be called by the ORB when a servant // raises an unexpected exception // public class UnknownExceptionStrategy_impl extends org.omg.CORBA.LocalObject implements UnknownExceptionStrategy { protected org.omg.CORBA.ORB orb_; public UnknownExceptionStrategy_impl(org.omg.CORBA.ORB orb) { orb_ = orb; } // // Handle an unknown exception. If this method doesn't throw // a SystemException, the ORB will return CORBA::UNKNOWN to // the client. // public void unknown_exception(UnknownExceptionInfo info) { String msg = "Servant method raised a non-CORBA exception"; if (info.response_expected()) msg += "\nClient receives this exception as CORBA::UNKNOWN"; msg += "\noperation name: \""; msg += info.operation(); msg += '"'; org.apache.yoko.orb.OCI.TransportInfo transportInfo = info .transport_info(); if (transportInfo != null) { String desc = transportInfo.describe(); msg += '\n'; msg += desc; } else { msg += "\nCollocated method call"; } msg += "\n"; msg += info.describe_exception(); Logger logger = ((org.apache.yoko.orb.CORBA.ORB) orb_).logger(); logger.warning(msg); } public void destroy() { orb_ = null; } }
6,257
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/URLRegistryHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/URLRegistry:1.0 // final public class URLRegistryHolder implements org.omg.CORBA.portable.Streamable { public URLRegistry value; public URLRegistryHolder() { } public URLRegistryHolder(URLRegistry initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = URLRegistryHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { URLRegistryHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return URLRegistryHelper.type(); } }
6,258
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ProtocolPolicyHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ProtocolPolicy:1.0 // final public class ProtocolPolicyHelper { public static void insert(org.omg.CORBA.Any any, ProtocolPolicy val) { any.insert_Object(val, type()); } public static ProtocolPolicy extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "ProtocolPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/ProtocolPolicy:1.0"; } public static ProtocolPolicy read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, ProtocolPolicy val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static ProtocolPolicy narrow(org.omg.CORBA.Object val) { try { return (ProtocolPolicy)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,259
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeConverterBase.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; abstract public class CodeConverterBase // implements CodeSetReader, CodeSetWriter { // // Source and destination code set // protected CodeSetInfo from_; protected CodeSetInfo to_; // // The UTF-8 or fixed width reader/writer // private CodeSetReader reader_; private CodeSetWriter writer_; private static CodeSetInfo noneInstance_; CodeConverterBase(CodeSetInfo from, CodeSetInfo to) { if ((from == null || to == null) && noneInstance_ == null) { noneInstance_ = new CodeSetInfo("none", 0, 0, null, (short) 2); } if (from == null) from = noneInstance_; if (to == null) to = noneInstance_; from_ = from; to_ = to; if (from.rgy_value == CodeSetDatabase.UTF8) reader_ = new UTF8Reader(); else if (from.rgy_value == CodeSetDatabase.UTF16) reader_ = new UTF16Reader(); else if (from.max_bytes <= 2) reader_ = new FixedWidth2Reader(); else { // // Java doesn't support wide characters larger than 16 bit // Assert._OB_assert(false); } if (to.rgy_value == CodeSetDatabase.UTF8) writer_ = new UTF8Writer(); else if (to.rgy_value == CodeSetDatabase.UTF16) writer_ = new UTF16Writer(); else if (to.max_bytes <= 2) writer_ = new FixedWidth2Writer(); else { // // Java doesn't support wide characters larger than 16 bit // Assert._OB_assert(false); } } final public boolean equals(java.lang.Object obj) { if (obj == null) return false; if (obj == this) return true; CodeConverterBase b = (CodeConverterBase) obj; return (from_.rgy_value == b.from_.rgy_value && to_.rgy_value == b.to_.rgy_value); } final public int hashCode() { return from_.rgy_value + 29 * to_.rgy_value; } final public char read_char(org.apache.yoko.orb.CORBA.InputStream in) throws org.omg.CORBA.DATA_CONVERSION { return reader_.read_char(in); } public char read_wchar(org.apache.yoko.orb.CORBA.InputStream in, int len) throws org.omg.CORBA.DATA_CONVERSION { return reader_.read_wchar(in, len); } public void write_char(org.apache.yoko.orb.CORBA.OutputStream out, char v) throws org.omg.CORBA.DATA_CONVERSION { writer_.write_char(out, v); } public void write_wchar(org.apache.yoko.orb.CORBA.OutputStream out, char v) throws org.omg.CORBA.DATA_CONVERSION { writer_.write_wchar(out, v); } public int read_count_wchar(char v) { return reader_.count_wchar(v); } public int write_count_wchar(char v) { return writer_.count_wchar(v); } final public boolean readerRequired() { return (from_.rgy_value == CodeSetDatabase.UTF8) || (from_.rgy_value == CodeSetDatabase.UTF16); } final public boolean writerRequired() { return (to_.rgy_value == CodeSetDatabase.UTF8) || (to_.rgy_value == CodeSetDatabase.UTF16); } final public CodeSetInfo getFrom() { return from_; } final public CodeSetInfo getTo() { return to_; } final public void set_reader_flags(int flags) { reader_.set_flags(flags); } final public void set_writer_flags(int flags) { writer_.set_flags(flags); } // // Get conversion type // public abstract boolean conversionRequired(); // // Convert narrow or wide character // public abstract char convert(char value); }
6,260
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnresolvedException.java
package org.apache.yoko.orb.OB; import static org.apache.yoko.orb.OCI.GiopVersion.GIOP1_2; import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.CORBA.InputStream; import org.apache.yoko.orb.OCI.Buffer; import org.omg.CORBA.SystemException; import org.omg.CORBA.UNKNOWN; import org.omg.CORBA.portable.UnknownException; import org.omg.SendingContext.CodeBase; public class UnresolvedException extends UnknownException { private static final Logger LOGGER = Logger.getLogger(UnresolvedException.class.getName()); private final UNKNOWN ex; private final byte[] data; private final CodeConverters converters; private final CodeBase sendingContextRuntime; private final String codebase; UnresolvedException(UNKNOWN ex, byte[] data, InputStream is) { super(ex); super.completed = ex.completed; super.minor = ex.minor; this.ex = ex; this.data = data; this.converters = is._OB_codeConverters(); this.sendingContextRuntime = is.__getSendingContextRuntime(); this.codebase = is.__getCodeBase(); } public SystemException resolve() { Buffer buf = new Buffer(data, data.length); try (org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(buf, 0, false, converters, GIOP1_2)) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine(String.format("Unpacking Unknown Exception Info%n%s", in.dumpData())); try { in.__setSendingContextRuntime(sendingContextRuntime); in.__setCodeBase(codebase); in._OB_readEndian(); Throwable t = (Throwable) in.read_value(); UnknownException x = new UnknownException(t); x.completed = ex.completed; x.minor = ex.minor; return x; } catch (Exception e) { final String dump = in.dumpData(); final int curPos = in.buf_.pos(); in.buf_.pos(0); final String fullDump = in.dumpData(); in.buf_.pos(curPos); try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { e.printStackTrace(pw); LOGGER.severe(String.format("%s:%n%s:%n%s%n%s:%n%s%n%s:%n%s", "Exception reading UnknownExceptionInfo service context", "Remaining data", dump, "Full data", fullDump, "Exception thrown", sw.toString())); } } } catch (IOException e) { //ignore IOException from AutoCloseable.close() } return ex; } private void readObject(ObjectInputStream ois) throws IOException { throw new NotSerializableException(); } private void writeObject(ObjectOutputStream oos) throws IOException { throw new NotSerializableException(); } }
6,261
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocProtocolHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CorbalocProtocol:1.0 // final public class CorbalocProtocolHelper { public static void insert(org.omg.CORBA.Any any, CorbalocProtocol val) { any.insert_Object(val, type()); } public static CorbalocProtocol extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "CorbalocProtocol"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/CorbalocProtocol:1.0"; } public static CorbalocProtocol read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, CorbalocProtocol val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static CorbalocProtocol narrow(org.omg.CORBA.Object val) { try { return (CorbalocProtocol)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,262
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyFactory_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.OB.DispatchRequest; import org.apache.yoko.orb.OB.DispatchStrategy; import org.apache.yoko.orb.OB.DispatchStrategyFactory; import org.apache.yoko.orb.OB.InvalidThreadPool; import org.apache.yoko.orb.OB.SAME_THREAD; import org.apache.yoko.orb.OB.THREAD_PER_REQUEST; import org.apache.yoko.orb.OB.THREAD_POOL; // ---------------------------------------------------------------------- // DispatchThreadSameThread // ---------------------------------------------------------------------- class DispatchSameThread_impl extends org.omg.CORBA.LocalObject implements DispatchStrategy { DispatchSameThread_impl() { } // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public int id() { return SAME_THREAD.value; } public org.omg.CORBA.Any info() { return new org.apache.yoko.orb.CORBA.Any(); } public void dispatch(DispatchRequest request) { // // Invoke the request // request.invoke(); } } // ---------------------------------------------------------------------- // DispatchThreadPerRequest // ---------------------------------------------------------------------- class DispatchThreadPerRequest_impl extends org.omg.CORBA.LocalObject implements DispatchStrategy { class Dispatcher extends Thread { private DispatchRequest request_; Dispatcher(DispatchRequest request) { super("Yoko:ThreadPerRequest:Dispatcher"); request_ = request; } public void run() { // // Invoke the request // request_.invoke(); } } DispatchThreadPerRequest_impl() { } // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public int id() { return THREAD_PER_REQUEST.value; } public org.omg.CORBA.Any info() { return new org.apache.yoko.orb.CORBA.Any(); } public void dispatch(DispatchRequest request) { try { Thread t = new Dispatcher(request); t.start(); } catch (OutOfMemoryError e) { throw new org.omg.CORBA.TRANSIENT(); } } } // ---------------------------------------------------------------------- // DispatchThreadPool_impl // ---------------------------------------------------------------------- class DispatchThreadPool_impl extends org.omg.CORBA.LocalObject implements DispatchStrategy { private int id_; private ThreadPool pool_; // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public int id() { return THREAD_POOL.value; } public org.omg.CORBA.Any info() { org.omg.CORBA.Any any = new org.apache.yoko.orb.CORBA.Any(); any.insert_ulong(id_); return any; } public void dispatch(DispatchRequest request) { pool_.add(request); } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ DispatchThreadPool_impl(int id, ThreadPool pool) { id_ = id; pool_ = pool; } } public class DispatchStrategyFactory_impl extends org.omg.CORBA.LocalObject implements DispatchStrategyFactory { static final Logger logger = Logger.getLogger(DispatchStrategyFactory.class.getName()); // // A sequence of thread pools. The index in the sequence is the // thread pool id. // private java.util.Vector pools_ = new java.util.Vector(); // // Has the default thread pool been created yet? // private boolean haveDefaultThreadPool_ = false; // // If so, what is the thread pool id? // private int defaultThreadPool_; // // Has the factory been destroyed? // private boolean destroy_ = false; // // The ORB instance // private ORBInstance orbInstance_ = null; // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public synchronized int create_thread_pool(int nthreads) { // // The ORB destroys this object, so it's an initialization // error if this operation is called after ORB destruction // if (destroy_) { throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes .describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed), org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } // // Find the first empty thread pool // int i; for (i = 0; i < pools_.size(); i++) { if (pools_.elementAt(i) == null) { break; } } // // If there is no empty slot then append an empty slot // if (i >= pools_.size()) { pools_.addElement(null); } // // Allocate a new ThreadPool // pools_.setElementAt(new ThreadPool(i, nthreads), i); return i; } public synchronized void destroy_thread_pool(int id) throws InvalidThreadPool { // // The ORB destroys this object, so it's an initialization error // if this operation is called after ORB destruction // if (destroy_) { throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes .describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed), org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } if (id < 0 || id > pools_.size() || pools_.elementAt(id) == null) { throw new InvalidThreadPool(); } // // Destroy the ThreadPool // ((ThreadPool) pools_.elementAt(id)).destroy(); // // Empty the slot associated with this thread pool // pools_.setElementAt(null, id); } public synchronized DispatchStrategy create_thread_pool_strategy(int id) throws InvalidThreadPool { // // The ORB destroys this object, so it's an initialization error // if this operation is called after ORB destruction // if (destroy_) { throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes .describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed), org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } if (id < 0 || id > pools_.size() || pools_.elementAt(id) == null) { throw new InvalidThreadPool(); } return new DispatchThreadPool_impl(id, (ThreadPool) pools_ .elementAt(id)); } public synchronized DispatchStrategy create_same_thread_strategy() { // // The ORB destroys this object, so it's an initialization error // if this operation is called after ORB destruction // if (destroy_) { throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes .describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed), org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } return new DispatchSameThread_impl(); } public synchronized DispatchStrategy create_thread_per_request_strategy() { // // The ORB destroys this object, so it's an initialization error // if this operation is called after ORB destruction // if (destroy_) { throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes .describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed), org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } return new DispatchThreadPerRequest_impl(); } public synchronized DispatchStrategy create_default_dispatch_strategy() { // // The ORB destroys this object, so it's an initialization error // if this operation is called after ORB destruction // if (destroy_) { throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes .describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed), org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } // // Get the ORB properties // java.util.Properties properties = orbInstance_.getProperties(); // // Set the dispatch strategy policy as specified by the // conc_model property // String value = properties.getProperty("yoko.orb.oa.conc_model"); if (value != null) { logger.fine("Defined concurrency model is " + value); if (value.equals("threaded") || value.equals("thread_per_client")) { logger.fine("Using same thread dispatch strategy"); return create_same_thread_strategy(); } else if (value.equals("thread_per_request")) { logger.fine("Using thread per request dispatch strategy"); return create_thread_per_request_strategy(); } else if (value.equals("thread_pool")) { // // If there is no default thread pool yet then create one, // with a default of 10 threads. // if (!haveDefaultThreadPool_) { haveDefaultThreadPool_ = true; value = properties.getProperty("yoko.orb.oa.thread_pool"); int nthreads = 0; if (value != null) { nthreads = Integer.parseInt(value); } if (nthreads == 0) { nthreads = 10; } logger.fine("Creating a thread pool of size " + nthreads); defaultThreadPool_ = create_thread_pool(nthreads); } try { logger.fine("Using a thread pool dispatch strategy"); return create_thread_pool_strategy(defaultThreadPool_); } catch (InvalidThreadPool ex) { Assert._OB_assert(ex); } } else { String err = "yoko.orb.oa.conc_model: Unknown value `"; err += value; err += "'"; orbInstance_.getLogger().warning(err); } } // // The default is to use a thread-per-request. Not doing this can cause // deadlocks, so the single thread // logger.fine("Using default thread per request strategy"); return create_thread_per_request_strategy(); } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ public DispatchStrategyFactory_impl() { } public synchronized void _OB_setORBInstance(ORBInstance orbInstance) { orbInstance_ = orbInstance; } protected synchronized void _OB_destroy() { // // The ORB destroys this object, so it's an initialization error // if this operation is called after ORB destruction // if (destroy_) throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes .describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed), org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO); destroy_ = true; orbInstance_ = null; // // Destroy each of the thread pools // for (int i = 0; i < pools_.size(); i++) { ThreadPool pool = (ThreadPool) pools_.elementAt(i); if (pool != null) { pool.destroy(); pools_.setElementAt(null, i); } } } }
6,263
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/INS.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // This class provides a wrapper for the string_to_object conversion // class INS { // ---------------------------------------------------------------------- // INS package member implementations // ---------------------------------------------------------------------- static org.omg.CORBA.Object stringToObject(ORBInstance orbInstance, String s) { return orbInstance.getURLRegistry().parse_url(s); } }
6,264
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/HexConverter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; public final class HexConverter { final static private char[] asciiToHex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static byte[] octetsToAsciiBytes(byte[] oct, int count) { Assert._OB_assert(count <= oct.length); byte[] result = new byte[count * 2]; for (int i = 0, pos = 0; i < count; i++) { byte b = oct[i]; result[pos++] = (byte) asciiToHex[(b >> 4) & 0x0f]; result[pos++] = (byte) asciiToHex[b & 0x0f]; } return result; } private static char[] octetsToAsciiChars(byte[] oct, int count) { Assert._OB_assert(count <= oct.length); char[] result = new char[count * 2]; for (int i = 0, pos = 0; i < count; i++) { byte b = oct[i]; result[pos++] = asciiToHex[(b >> 4) & 0x0f]; result[pos++] = asciiToHex[b & 0x0f]; } return result; } public static String octetsToAscii(byte[] oct, int count) { StringBuffer buf = new StringBuffer(count * 2); buf.append(octetsToAsciiChars(oct, count)); return buf.toString(); } public static byte[] asciiToOctets(String str, int offset) { int slen = str.length() - offset; // // Two ASCII characters for each octet // if ((slen & 1) != 0) return null; int len = slen >> 1; byte[] oct = new byte[len]; for (int i = 0, j = offset; i < len; i++) { char highChar = str.charAt(j++); char lowChar = str.charAt(j++); int high, low; if (highChar >= '0' && highChar <= '9') high = highChar - '0'; else if (highChar >= 'a' && highChar <= 'f') high = 10 + highChar - 'a'; else if (highChar >= 'A' && highChar <= 'F') high = 10 + highChar - 'A'; else return null; if (lowChar >= '0' && lowChar <= '9') low = lowChar - '0'; else if (lowChar >= 'a' && lowChar <= 'f') low = 10 + lowChar - 'a'; else if (lowChar >= 'A' && lowChar <= 'F') low = 10 + lowChar - 'A'; else return null; oct[i] = (byte) (16 * high + low); } return oct; } public static byte[] asciiToOctets(String str) { return asciiToOctets(str, 0); } }
6,265
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RETRY_POLICY_ID.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RETRY_POLICY_ID:1.0 // /** * * This policy type identifies the retry policy. * **/ public interface RETRY_POLICY_ID { int value = (int)(1330577412L); }
6,266
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectionReusePolicy.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ConnectionReusePolicy:1.0 // /** * * The connection reuse policy. This policy determines whether * connections may be reused or are private to specific objects. * **/ public interface ConnectionReusePolicy extends ConnectionReusePolicyOperations, org.omg.CORBA.Policy { }
6,267
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PIDIIDowncall.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; public class PIDIIDowncall extends PIDowncall { // // Argument, result and exception list description provided by the // DII // protected org.omg.CORBA.NVList args_; protected org.omg.CORBA.NamedValue result_; protected org.omg.CORBA.ExceptionList exceptionList_; // ---------------------------------------------------------------------- // PIDIIDowncall private and protected member implementations // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // PIDIIDowncall public member implementations // ---------------------------------------------------------------------- public PIDIIDowncall(ORBInstance orbInstance, Client client, org.apache.yoko.orb.OCI.ProfileInfo profileInfo, RefCountPolicyList policies, String op, boolean resp, org.omg.IOP.IOR IOR, org.omg.IOP.IOR origIOR, PIManager piManager, org.omg.CORBA.NVList args, org.omg.CORBA.NamedValue result, org.omg.CORBA.ExceptionList exceptions) { super(orbInstance, client, profileInfo, policies, op, resp, IOR, origIOR, piManager); args_ = args; result_ = result; exceptionList_ = exceptions; } public org.apache.yoko.orb.CORBA.OutputStream preMarshal() throws LocationForward, FailureException { requestInfo_ = piManager_.clientSendRequest(op_, responseExpected_, IOR_, origIOR_, profileInfo_, policies_.value, requestSCL_, replySCL_, args_, result_, exceptionList_); return preMarshalBase(); // Equivalent to Downcall::preMarshal() } }
6,268
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ZeroPortPolicyHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ZeroPortPolicy:1.0 // final public class ZeroPortPolicyHelper { public static void insert(org.omg.CORBA.Any any, ZeroPortPolicy val) { any.insert_Object(val, type()); } public static ZeroPortPolicy extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "ZeroPortPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/ZeroPortPolicy:1.0"; } public static ZeroPortPolicy read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, ZeroPortPolicy val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static ZeroPortPolicy narrow(org.omg.CORBA.Object val) { try { return (ZeroPortPolicy)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,269
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Upcall.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import static org.apache.yoko.orb.OB.CodeSetDatabase.UTF16; import static org.apache.yoko.orb.OCI.GiopVersion.GIOP1_2; import java.io.IOException; import java.util.Arrays; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.CORBA.OutputStream; import org.apache.yoko.orb.OCI.Buffer; import org.apache.yoko.orb.OCI.GiopVersion; import org.apache.yoko.util.cmsf.CmsfThreadLocal; import org.apache.yoko.util.cmsf.CmsfThreadLocal.CmsfOverride; import org.omg.CORBA.INTERNAL; import org.omg.CORBA.portable.UnknownException; import org.omg.IOP.ExceptionDetailMessage; import org.omg.IOP.ServiceContext; import org.omg.IOP.UnknownExceptionInfo; public class Upcall { static final Logger logger = Logger.getLogger(Upcall.class.getName()); // // The ORBInstance object // protected ORBInstance orbInstance_; // // Upcall delegates to UpcallReturn upon return from the // upcall. If this is nil, then no response is expected (i.e., // this is a oneway call). // protected UpcallReturn upcallReturn_; // // Information about the IOR profile // protected org.apache.yoko.orb.OCI.ProfileInfo profileInfo_; // // The OCI transport info object // protected org.apache.yoko.orb.OCI.TransportInfo transportInfo_; // // The unique request ID // protected int reqId_; // // The name of the operation // protected String op_; // // Holds the inout/out parameters and return value // protected org.apache.yoko.orb.CORBA.OutputStream out_; // // Holds the in/inout parameters // protected org.apache.yoko.orb.CORBA.InputStream in_; // // The request service context list // protected org.omg.IOP.ServiceContext[] requestSCL_; // // The reply service context list // (Must be a Vector because it can be modified by interceptors) // protected Vector<ServiceContext> replySCL_ = new Vector<>(); // // The dispatch request // protected DispatchRequest dispatchRequest_; // // Dispatch strategy // protected DispatchStrategy dispatchStrategy_; // // The servant and POA // protected org.omg.PortableServer.Servant servant_; protected org.apache.yoko.orb.OBPortableServer.POA_impl poa_; // // Whether postinvoke() has been called // protected boolean postinvokeCalled_; // // Java only // // Whether beginUserException has been called. We must delay the // call to endUserException until we are sure nothing else will // be marshalled (e.g., in case a SystemException occurs after // marshalling). This flag is set to true in beginUserException. // Only a SystemException or LocationForward can occur after // a UserException, so the flag is reset to false in // setSystemException and setLocationForward. // protected boolean userEx_; // // Codesets SC // protected org.omg.IOP.ServiceContext codeSetSC_; protected org.omg.IOP.ServiceContext codeBaseSC_; // ---------------------------------------------------------------------- // Upcall public member implementations // ---------------------------------------------------------------------- public Upcall(ORBInstance orbInstance, UpcallReturn upcallReturn, org.apache.yoko.orb.OCI.ProfileInfo profileInfo, org.apache.yoko.orb.OCI.TransportInfo transportInfo, int requestId, String op, org.apache.yoko.orb.CORBA.InputStream in, org.omg.IOP.ServiceContext[] requestSCL) { orbInstance_ = orbInstance; upcallReturn_ = upcallReturn; profileInfo_ = profileInfo; transportInfo_ = transportInfo; reqId_ = requestId; op_ = op; in_ = in; requestSCL_ = requestSCL; servant_ = null; poa_ = null; postinvokeCalled_ = false; userEx_ = false; // Java only logger.fine("Creating upcall request for operation " + op + " and request id " + requestId); in._OB_ORBInstance(orbInstance_); } public ORBInstance orbInstance() { return orbInstance_; } public org.apache.yoko.orb.OCI.ProfileInfo profileInfo() { return profileInfo_; } public org.apache.yoko.orb.OCI.TransportInfo transportInfo() { return transportInfo_; } public int requestId() { return reqId_; } public String operation() { return op_; } public boolean responseExpected() { return upcallReturn_ != null; } public boolean postinvokeCalled() { return postinvokeCalled_; } public org.apache.yoko.orb.CORBA.OutputStream output() { return out_; } public org.apache.yoko.orb.CORBA.InputStream input() { return in_; } public void createOutputStream(int offset) { org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer( offset); buf.pos(offset); out_ = new org.apache.yoko.orb.CORBA.OutputStream(buf, in_ ._OB_codeConverters(), GiopVersion.get(profileInfo_.major, profileInfo_.minor)); } public org.apache.yoko.orb.CORBA.InputStream preUnmarshal() throws LocationForward { return in_; } public void unmarshalEx(org.omg.CORBA.SystemException ex) throws LocationForward { throw ex; } public void postUnmarshal() throws LocationForward { } public void postinvoke() throws LocationForward { if (servant_ != null) { Assert._OB_assert(poa_ != null && !postinvokeCalled_); servant_ = null; postinvokeCalled_ = true; poa_._OB_postinvoke(); // May raise SystemException } } // initialize internal service contexts private void initServiceContexts() { /* if (codeSetSC_ == null) { // // Create CONV_FRAME::CodeSetContext // org.omg.CONV_FRAME.CodeSetContext ctx = new org.omg.CONV_FRAME.CodeSetContext(); CodeConverters conv = codeConverters(); if (conv.outputCharConverter != null) ctx.char_data = conv.outputCharConverter.getTo().rgy_value; else ctx.char_data = CodeSetDatabase.ISOLATIN1; if (conv.outputWcharConverter != null) ctx.wchar_data = conv.outputWcharConverter.getTo().rgy_value; else ctx.wchar_data = orbInstance_.getNativeWcs(); // // Create encapsulation for CONV_FRAME::CodeSetContext // org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); org.apache.yoko.orb.CORBA.OutputStream outCSC = new org.apache.yoko.orb.CORBA.OutputStream( buf); outCSC._OB_writeEndian(); org.omg.CONV_FRAME.CodeSetContextHelper.write(outCSC, ctx); // // Create service context containing the // CONV_FRAME::CodeSetContext encapsulation // codeSetSC_ = new org.omg.IOP.ServiceContext(); codeSetSC_.context_id = org.omg.IOP.CodeSets.value; int len = buf.length(); byte[] data = buf.data(); codeSetSC_.context_data = new byte[len]; System.arraycopy(data, 0, codeSetSC_.context_data, 0, len); } */ if (codeBaseSC_ == null) { javax.rmi.CORBA.ValueHandler valueHandler = javax.rmi.CORBA.Util.createValueHandler(); org.omg.SendingContext.CodeBase codeBase = (org.omg.SendingContext.CodeBase) valueHandler.getRunTimeCodeBase(); org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); org.apache.yoko.orb.CORBA.OutputStream outCBC = new org.apache.yoko.orb.CORBA.OutputStream( buf); outCBC._OB_writeEndian(); org.omg.SendingContext.CodeBaseHelper.write(outCBC, codeBase); codeBaseSC_ = new org.omg.IOP.ServiceContext(); codeBaseSC_.context_id = org.omg.IOP.SendingContextRunTime.value; int len = buf.length(); byte[] data = buf.data(); codeBaseSC_.context_data = new byte[len]; System.arraycopy(data, 0, codeBaseSC_.context_data, 0, len); } // // NOTE: We don't initialize the INVOCATION_POLICIES service context // here because the list of policies can change from one invocation to // the next. Instead, we need to get the policies and build the // service context each time we make an invocation. // } public org.apache.yoko.orb.CORBA.OutputStream preMarshal() throws LocationForward { // // If we have an UpcallReturn object, then invoking upcallBeginReply // will eventually result in a call to createOutputStream. // // If we don't have an UpcallReturn object, then it means a oneway // invocation was made for a twoway operation. We return a dummy // OutputStream to make the skeleton happy and avoid a crash. // if (upcallReturn_ != null) { addUnsentConnectionServiceContexts(); org.omg.IOP.ServiceContext[] scl = new org.omg.IOP.ServiceContext[replySCL_ .size()]; replySCL_.copyInto(scl); upcallReturn_.upcallBeginReply(this, scl); } else { org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); out_ = new org.apache.yoko.orb.CORBA.OutputStream(buf, in_ ._OB_codeConverters(), GiopVersion.get(profileInfo_.major, profileInfo_.minor)); } out_._OB_ORBInstance(this.orbInstance()); return out_; } private void addUnsentConnectionServiceContexts() { if (!upcallReturn_.replySent() && (profileInfo_.major > 1 || profileInfo_.minor >= 1)) { initServiceContexts(); // CoreTraceLevels coreTraceLevels = orbInstance_ // .getCoreTraceLevels(); // if (coreTraceLevels.traceConnections() >= 2) { // CodeConverters conv = codeConverters(); // String msg = "sending transmission code sets"; // msg += "\nchar code set: "; // if (conv.outputCharConverter != null) // msg += conv.outputCharConverter.getTo().description; // else { // CodeSetInfo info = CodeSetDatabase.instance() // .getCodeSetInfo(orbInstance_.getNativeCs()); // msg += info.description; // } // msg += "\nwchar code set: "; // if (conv.outputWcharConverter != null) // msg += conv.outputWcharConverter.getTo().description; // else { // CodeSetInfo info = CodeSetDatabase.instance() // .getCodeSetInfo(orbInstance_.getNativeWcs()); // msg += info.description; // } // orbInstance_.getLogger().trace("outgoing", msg); // } // Assert._OB_assert(codeSetSC_ != null); // replySCL_.add(codeSetSC_); Assert._OB_assert(codeBaseSC_ != null); replySCL_.add(codeBaseSC_); } } public void marshalEx(org.omg.CORBA.SystemException ex) throws LocationForward { throw ex; } public void postMarshal() throws LocationForward { if (upcallReturn_ != null) upcallReturn_.upcallEndReply(this); } // // NOTE: Not used in Java // public void setUserException(org.omg.CORBA.UserException ex) { if (upcallReturn_ != null) { org.omg.IOP.ServiceContext[] scl = new org.omg.IOP.ServiceContext[replySCL_ .size()]; replySCL_.copyInto(scl); upcallReturn_.upcallUserException(this, ex, scl); } } public void setUserException(org.omg.CORBA.Any any) { if (upcallReturn_ != null) { org.omg.IOP.ServiceContext[] scl = new org.omg.IOP.ServiceContext[replySCL_ .size()]; replySCL_.copyInto(scl); upcallReturn_.upcallBeginUserException(this, scl); try { any.write_value(out_); } catch (org.omg.CORBA.SystemException ex) { try { marshalEx(ex); } catch (LocationForward f) { Assert._OB_assert(ex); // shouldn't happen } } // // In Java, we must delay the call to upcallEndUserException // // upcallReturn_.upcallEndUserException(this); userEx_ = true; } } // // This method is needed only in Java. The skeleton marshals the // exception. If called by a portable skeleton, the exception will // be null. // public org.apache.yoko.orb.CORBA.OutputStream beginUserException( org.omg.CORBA.UserException ex) { if (upcallReturn_ != null) { org.omg.IOP.ServiceContext[] scl = new org.omg.IOP.ServiceContext[replySCL_ .size()]; replySCL_.copyInto(scl); upcallReturn_.upcallBeginUserException(this, scl); userEx_ = true; return out_; } return null; } // // This method is needed only in Java // public boolean userException() { return userEx_; } // // This method is needed only in Java // public void endUserException() { if (upcallReturn_ != null) { Assert._OB_assert(userEx_); upcallReturn_.upcallEndUserException(this); } } public void setSystemException(org.omg.CORBA.SystemException ex) { if (upcallReturn_ != null) { addUnsentConnectionServiceContexts(); userEx_ = false; if (ex instanceof UnknownException) { // need to create service contexts for underlying exception createUnknownExceptionServiceContexts((UnknownException)ex, replySCL_); } ServiceContext[] scl = new ServiceContext[replySCL_.size()]; replySCL_.copyInto(scl); upcallReturn_.upcallSystemException(this, ex, scl); } } private static void createUnknownExceptionServiceContexts(UnknownException ex, Vector<ServiceContext> scl) { final Throwable t = ex.originalEx; try (CmsfOverride o = CmsfThreadLocal.override()) { CodeConverters codeConverters = new CodeConverters(); codeConverters.outputWcharConverter = CodeSetDatabase.instance().getConverter(UTF16, UTF16); Buffer buf = new Buffer(); try (OutputStream os = new OutputStream(buf, codeConverters, GIOP1_2)) { os._OB_writeEndian(); os.write_value(t, Throwable.class); ServiceContext sc = new ServiceContext(UnknownExceptionInfo.value, Arrays.copyOf(buf.data(), buf.length())); scl.add(sc); } } catch (IOException e) { throw (INTERNAL)(new INTERNAL(e.getMessage())).initCause(e); } } public void setLocationForward(org.omg.IOP.IOR ior, boolean perm) { if (upcallReturn_ != null) { userEx_ = false; // Java only org.omg.IOP.ServiceContext[] scl = new org.omg.IOP.ServiceContext[replySCL_ .size()]; replySCL_.copyInto(scl); upcallReturn_.upcallForward(this, ior, perm, scl); } } public void contextSwitch() { // // Do nothing. // } public void setDispatchInfo(DispatchRequest dispatchRequest, DispatchStrategy dispatchStrategy) { dispatchRequest_ = dispatchRequest; dispatchStrategy_ = dispatchStrategy; } public void setServantAndPOA(org.omg.PortableServer.Servant servant, org.apache.yoko.orb.OBPortableServer.POA_impl poa) { servant_ = servant; poa_ = poa; } // // Do the invocation // public void invoke() { // // If the creation of the Upcall object resulted in an error of // some sort then there will be no method invocation to perform. // In this case do nothing. // try { if (dispatchStrategy_ != null) { logger.fine("Dispatching request " + reqId_ + " with dispatch strategy " + dispatchStrategy_.getClass().getName()); dispatchStrategy_.dispatch(dispatchRequest_); } } catch (org.omg.CORBA.SystemException ex) { logger.log(Level.FINE, "Exception received dispatching request", ex); setSystemException(ex); } } }
6,270
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocURLSchemeOperations.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/CorbalocURLScheme:1.0 // /** * * CorbalocURLScheme implements the <code>corbaloc</code> URL scheme, * and serves as a registry for CorbalocProtocol objects. * * @see CorbalocProtocol * **/ public interface CorbalocURLSchemeOperations extends URLSchemeOperations { // // IDL:orb.yoko.apache.org/OB/CorbalocURLScheme/add_protocol:1.0 // /** * * Register a new <code>corbaloc</code> protocol. * * @param protocol The new protocol. * * @exception org.apache.yoko.orb.OB.CorbalocURLSchemePackage.ProtocolAlreadyExists Another protocol already exists * with the same name. * **/ void add_protocol(CorbalocProtocol protocol) throws org.apache.yoko.orb.OB.CorbalocURLSchemePackage.ProtocolAlreadyExists; // // IDL:orb.yoko.apache.org/OB/CorbalocURLScheme/find_protocol:1.0 // /** * * Find a protocol with the given name. * * @param name The protocol name, in lower case. * * @return The CorbalocProtocol, or nil if no match was found. * **/ CorbalocProtocol find_protocol(String name); }
6,271
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootManagerHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/BootManager:1.0 // final public class BootManagerHelper { public static void insert(org.omg.CORBA.Any any, BootManager val) { any.insert_Object(val, type()); } public static BootManager extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "BootManager"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/BootManager:1.0"; } public static BootManager read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, BootManager val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static BootManager narrow(org.omg.CORBA.Object val) { try { return (BootManager)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,272
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LOCATION_TRANSPARENCY_POLICY_ID.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/LOCATION_TRANSPARENCY_POLICY_ID:1.0 // /** * * This policy type identifies the location transparency policy. * **/ public interface LOCATION_TRANSPARENCY_POLICY_ID { int value = (int)(1330577414L); }
6,273
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPIncomingMessage.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final public class GIOPIncomingMessage { private ORBInstance orbInstance_; private org.apache.yoko.orb.CORBA.InputStream in_; private static int maxMessageSize_; // // Message header // private org.omg.GIOP.Version version_ = new org.omg.GIOP.Version(); private boolean byteOrder_; private boolean fragment_; private org.omg.GIOP.MsgType_1_1 type_; private int size_; private class Fragment { private org.omg.GIOP.Version version; private boolean byteOrder; private int reqId; private boolean haveReqId; private org.omg.GIOP.MsgType_1_1 type; private org.apache.yoko.orb.OCI.Buffer buf; Fragment next; void add(ORBInstance orbInstance, org.apache.yoko.orb.OCI.Buffer b) { int len = buf.length(); if (maxMessageSize_ > 0 && len + b.rest_length() > maxMessageSize_) { String msg = "incoming fragment exceeds " + "maximum message size (" + maxMessageSize_ + ")"; orbInstance_.getLogger().warning(msg); throw new org.omg.CORBA.IMP_LIMIT(org.apache.yoko.orb.OB.MinorCodes .describeImpLimit(org.apache.yoko.orb.OB.MinorCodes.MinorMessageSizeLimit), org.apache.yoko.orb.OB.MinorCodes.MinorMessageSizeLimit, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } buf.realloc(len + b.rest_length()); System.arraycopy(b.data(), b.pos(), buf.data(), len, b .rest_length()); } } private Fragment fragmentHead_; // for GIOP 1.2 private Fragment lastFragment_; // for GIOP 1.1 // ---------------------------------------------------------------------- // GIOPIncomingMessage private and protected member implementations // ---------------------------------------------------------------------- private int readFragmentHeader(org.apache.yoko.orb.CORBA.InputStream in) { int id = 0; switch (version_.minor) { case 0: { // // Not supported in GIOP 1.0 // Assert._OB_assert(false); } case 1: { // // Fragment message is supported in 1.1, but not FragmentHeader // Assert._OB_assert(false); } case 2: { id = in.read_ulong(); // // TODO: Possibly need to align on 8-octet boundary in GIOP 1.2 // (see Interop issue #2521) // break; } default: Assert._OB_assert(false); } return id; } private void skipServiceContextList(org.apache.yoko.orb.CORBA.InputStream in) { int len = in.read_ulong(); for (int i = 0; i < len; i++) { // context_id in._OB_skipAlign(4); in._OB_skip(4); // context_data int datalen = in.read_ulong(); in._OB_skip(datalen); } } private void readServiceContextList(org.omg.IOP.ServiceContextListHolder scl) { int len = in_.read_ulong(); scl.value = new org.omg.IOP.ServiceContext[len]; if (len != 0) { for (int i = 0; i < len; i++) { scl.value[i] = new org.omg.IOP.ServiceContext(); org.omg.IOP.ServiceContext sc = scl.value[i]; sc.context_id = in_.read_ulong(); int datalen = in_.read_ulong(); sc.context_data = new byte[datalen]; in_.read_octet_array(sc.context_data, 0, datalen); } } } private void readTargetAddress(org.omg.GIOP.TargetAddressHolder target) { target.value = new org.omg.GIOP.TargetAddress(); short disc = in_.read_short(); switch (disc) { case 0: // GIOP::KeyAddr { int len = in_.read_ulong(); byte[] seq = new byte[len]; in_.read_octet_array(seq, 0, len); target.value.object_key(seq); break; } case 1: // GIOP::ProfileAddr { target.value.profile(org.omg.IOP.TaggedProfileHelper.read(in_)); break; } case 2: // GIOP::ReferenceAddr { target.value.ior(org.omg.GIOP.IORAddressingInfoHelper.read(in_)); break; } default: throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorNoGIOP) + ": invalid target address", org.apache.yoko.orb.OB.MinorCodes.MinorNoGIOP, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } } // ---------------------------------------------------------------------- // GIOPIncomingMessage package member implementations // ---------------------------------------------------------------------- GIOPIncomingMessage(ORBInstance orbInstance) { orbInstance_ = orbInstance; fragmentHead_ = null; lastFragment_ = null; } org.omg.GIOP.Version version() { return version_; } boolean swap() { return byteOrder_ != false; } org.omg.GIOP.MsgType_1_1 type() { return type_; } int size() { return size_; } org.apache.yoko.orb.CORBA.InputStream input() { org.apache.yoko.orb.CORBA.InputStream result = in_; in_ = null; return result; } void extractHeader(org.apache.yoko.orb.OCI.Buffer buf) { in_ = null; byte[] pos = buf.data(); if (pos[0] != (byte) 'G' || pos[1] != (byte) 'I' || pos[2] != (byte) 'O' || pos[3] != (byte) 'P') { throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorNoGIOP) + ": missing GIOP magic key", org.apache.yoko.orb.OB.MinorCodes.MinorNoGIOP, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } // // Peek at version // version_.major = pos[4]; version_.minor = pos[5]; if (version_.major != 1 || version_.minor > 2) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorVersion), org.apache.yoko.orb.OB.MinorCodes.MinorVersion, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(buf, 0, false); switch (version_.minor) { case 0: { in._OB_skip(6); // magic + GIOP_version byteOrder_ = in.read_boolean(); in._OB_swap(byteOrder_ != false); fragment_ = false; type_ = org.omg.GIOP.MsgType_1_1.from_int(in.read_octet()); size_ = in.read_ulong(); if (type_.value() > org.omg.GIOP.MsgType_1_1._MessageError) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage) + ": invalid message type for GIOP 1.0", org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); break; } case 1: case 2: { in._OB_skip(6); // magic + GIOP_version byte flags = in.read_octet(); byteOrder_ = ((flags & 0x01) == 1); fragment_ = ((flags & 0x02) == 2); in._OB_swap(byteOrder_ != false); type_ = org.omg.GIOP.MsgType_1_1.from_int(in.read_octet()); size_ = in.read_ulong(); if (type_.value() > org.omg.GIOP.MsgType_1_1._Fragment) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage) + ": invalid message type for GIOP 1.1/1.2", org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); break; } default: Assert._OB_assert(false); } if (maxMessageSize_ > 0 && size_ > maxMessageSize_) { String msg = "incoming message size (" + size_ + ") exceeds maximum (" + maxMessageSize_ + ")"; orbInstance_.getLogger().warning(msg); throw new org.omg.CORBA.IMP_LIMIT(org.apache.yoko.orb.OB.MinorCodes .describeImpLimit(org.apache.yoko.orb.OB.MinorCodes.MinorMessageSizeLimit), org.apache.yoko.orb.OB.MinorCodes.MinorMessageSizeLimit, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } // // The spec says: // // For GIOP version 1.2, if the second least significant bit of // Flags is 1, the sum of the message_size value and 12 must be // evenly divisible by 8. // if (version_.minor == 2 && fragment_ && (size_ + 12) % 8 != 0) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorFragment) + ": invalid GIOP 1.2 fragment size", org.apache.yoko.orb.OB.MinorCodes.MinorFragment, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } boolean consumeBuffer(org.apache.yoko.orb.OCI.Buffer buf) { // // Consume input buffer // boolean result = false; // // Handle initial fragmented message // if (fragment_ && type_ != org.omg.GIOP.MsgType_1_1.Fragment) { if (version_.minor < 1) { throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorFragment), org.apache.yoko.orb.OB.MinorCodes.MinorFragment, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } else if (version_.minor == 1) { // // In GIOP 1.1, fragments are only supported for request and // reply messages // if (type_ != org.omg.GIOP.MsgType_1_1.Request && type_ != org.omg.GIOP.MsgType_1_1.Reply) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorFragment), org.apache.yoko.orb.OB.MinorCodes.MinorFragment, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); // // If lastFragment_ is not 0, then the previous fragmented // message may have been cancelled // if (lastFragment_ != null) lastFragment_ = null; // // Try to obtain the request ID by unmarshalling the // Request or Reply header data. If the header is fragmented, // a MARSHAL exception could be raised if we don't have enough // data. // int reqId = 0; boolean haveReqId = false; try { org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf, 12, swap()); skipServiceContextList(in); reqId = in.read_ulong(); haveReqId = true; } catch (org.omg.CORBA.MARSHAL ex) { } lastFragment_ = new Fragment(); lastFragment_.version = new org.omg.GIOP.Version( version_.major, version_.minor); lastFragment_.byteOrder = byteOrder_; lastFragment_.reqId = reqId; lastFragment_.haveReqId = haveReqId; lastFragment_.type = type_; lastFragment_.buf = buf; lastFragment_.next = null; } else // GIOP 1.2 { // // In GIOP 1.2, fragments are only supported for request, // reply, locate request and locate reply messages // if (type_ != org.omg.GIOP.MsgType_1_1.Request && type_ != org.omg.GIOP.MsgType_1_1.Reply && type_ != org.omg.GIOP.MsgType_1_1.LocateRequest && type_ != org.omg.GIOP.MsgType_1_1.LocateReply) { throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorFragment), org.apache.yoko.orb.OB.MinorCodes.MinorFragment, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } // // Try to obtain the request ID by unmarshalling the // header data. If the header is fragmented, a MARSHAL // exception could be raised if we don't have enough // data. // int reqId = 0; boolean haveReqId = false; try { org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf, 12, swap()); reqId = in.read_ulong(); haveReqId = true; } catch (org.omg.CORBA.MARSHAL ex) { } // // What to do if initial message doesn't contain the // request ID? // Assert._OB_assert(haveReqId); // // Add new fragment to fragment list // Fragment f = new Fragment(); f.version = new org.omg.GIOP.Version(version_.major, version_.minor); f.byteOrder = byteOrder_; f.reqId = reqId; f.haveReqId = haveReqId; f.type = type_; f.buf = buf; f.next = fragmentHead_; fragmentHead_ = f; } } else if (type_ == org.omg.GIOP.MsgType_1_1.Fragment) { Fragment complete = null; if (version_.minor < 1) { // // Fragment not supported in GIOP 1.0 // throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorFragment), org.apache.yoko.orb.OB.MinorCodes.MinorFragment, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } else if (version_.minor == 1) { // // If lastFragment_ == 0, then we received a Fragment message // without an initial message // if (lastFragment_ == null) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorFragment), org.apache.yoko.orb.OB.MinorCodes.MinorFragment, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); // // Append buffer to existing data. We need to skip the // header data (the input stream is already positioned // past the header). // lastFragment_.add(orbInstance_, buf); // // If we haven't read the request ID yet, then try to // get it now // if (!lastFragment_.haveReqId) { org.apache.yoko.orb.CORBA.InputStream reqIn = new org.apache.yoko.orb.CORBA.InputStream( lastFragment_.buf, 12, swap()); try { skipServiceContextList(reqIn); lastFragment_.reqId = reqIn.read_ulong(); lastFragment_.haveReqId = true; } catch (org.omg.CORBA.MARSHAL ex) { } } // // If fragment_ == false, then this is the last fragment // if (!fragment_) { complete = lastFragment_; lastFragment_ = null; } } else // GIOP 1.2 { // // GIOP 1.2 defines the FragmentHeader message header, // to allow interleaving of Fragment messages for // different requests // org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf, 12, swap()); int reqId = readFragmentHeader(in); // // Find fragment data for request // Fragment frag = null; Fragment p = fragmentHead_; Fragment prev = null; while (p != null) { Fragment f = p; if (f.haveReqId && f.reqId == reqId) { frag = f; break; } else { prev = p; p = f.next; } } // // If no fragment was found for the request, then either // the request was discarded, or the server is sending // invalid messages. Otherwise, we can append the buffer // to the existing data. // if (frag != null) { // // Append buffer to existing data. We need to skip the // header data (the input stream is already positioned // past the header). // frag.add(orbInstance_, in._OB_buffer()); // // If fragment_ == false, then this is the last fragment // if (!fragment_) { // // Remove fragment from list // if (prev == null) fragmentHead_ = frag.next; else prev.next = frag.next; complete = frag; } } } // // We have received the last fragment, so reset our internal // state to appear as if we had just received the entire message // if (complete != null) { version_ = complete.version; byteOrder_ = complete.byteOrder; type_ = complete.type; fragment_ = false; // NOTE: size_ is the size of the message, which doesn't // include the message header. We need to adjust this for // fragmented messages otherwise we risk not detecting the // correct end of the buffer. size_ = complete.buf.length() - 12; in_ = new org.apache.yoko.orb.CORBA.InputStream(complete.buf, 12, swap()); complete = null; result = true; } } else if (type_ == org.omg.GIOP.MsgType_1_1.CancelRequest) { in_ = new org.apache.yoko.orb.CORBA.InputStream(buf, 12, swap()); // // Check if cancelled message corresponds to a fragment // int reqId = readCancelRequestHeader(); if (version_.minor == 1) // GIOP 1.1 { if (lastFragment_ != null && lastFragment_.haveReqId && lastFragment_.reqId == reqId) { lastFragment_ = null; } } else // GIOP 1.2 { Fragment p = fragmentHead_; while (p != null) { Fragment f = p; if (f.haveReqId && f.reqId == reqId) { p = f.next; f = null; break; } else p = f.next; } } in_._OB_reset(); result = true; } else { // // Message is not fragmented and is not a CancelRequest, so // we must have the complete message // in_ = new org.apache.yoko.orb.CORBA.InputStream(buf, 12, swap()); result = true; } return result; } int readRequestHeader(org.omg.CORBA.BooleanHolder response, org.omg.GIOP.TargetAddressHolder target, org.omg.CORBA.StringHolder op, org.omg.IOP.ServiceContextListHolder scl) { Assert._OB_assert(type_ == org.omg.GIOP.MsgType_1_1.Request); int id = 0; switch (version_.minor) { case 0: { int len; readServiceContextList(scl); // service_context id = in_.read_ulong(); // request_id response.value = in_.read_boolean(); // response_expected // // object_key // len = in_.read_ulong(); byte[] key = new byte[len]; in_.read_octet_array(key, 0, len); target.value = new org.omg.GIOP.TargetAddress(); target.value.object_key(key); // // Use octets for operation to avoid codeset conversion // len = in_.read_ulong(); byte[] s = new byte[len]; in_.read_octet_array(s, 0, len); op.value = new String(s, 0, len - 1); // op.value = in_.read_string(); // operation len = in_.read_ulong(); // requesting_principal if (len > 0) in_._OB_skip(len); break; } case 1: { int len; readServiceContextList(scl); // service_context id = in_.read_ulong(); // request_id response.value = in_.read_boolean(); // response_expected in_._OB_skip(3); // reserved // // object_key // len = in_.read_ulong(); byte[] key = new byte[len]; in_.read_octet_array(key, 0, len); target.value = new org.omg.GIOP.TargetAddress(); target.value.object_key(key); // // Use octets for operation to avoid codeset conversion // len = in_.read_ulong(); byte[] s = new byte[len]; in_.read_octet_array(s, 0, len); op.value = new String(s, 0, len - 1); // op.value = in_.read_string(); // operation len = in_.read_ulong(); // requesting_principal if (len > 0) in_._OB_skip(len); break; } case 2: { id = in_.read_ulong(); // request_id byte flags = in_.read_octet(); // response_flags response.value = ((flags & 0x01) == 1); in_._OB_skip(3); // reserved readTargetAddress(target); // // Use octets for operation to avoid codeset conversion // int len = in_.read_ulong(); byte[] s = new byte[len]; in_.read_octet_array(s, 0, len); op.value = new String(s, 0, len - 1); // op.value = in_.read_string(); // operation readServiceContextList(scl); // service_context // // For GIOP 1.2, the body (if present) must be aligned on // an 8-octet boundary // if (in_._OB_pos() < size_ + 12) { in_._OB_skipAlign(8); } break; } default: Assert._OB_assert(false); } return id; } int readReplyHeader(org.omg.GIOP.ReplyStatusType_1_2Holder status, org.omg.IOP.ServiceContextListHolder scl) { Assert._OB_assert(type_ == org.omg.GIOP.MsgType_1_1.Reply); int id = 0; switch (version_.minor) { case 0: case 1: { readServiceContextList(scl); // service_context id = in_.read_ulong(); // request_id // reply_status status.value = org.omg.GIOP.ReplyStatusType_1_2.from_int(in_ .read_ulong()); if (status.value.value() > org.omg.GIOP.ReplyStatusType_1_2._LOCATION_FORWARD) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage) + ": invalid reply status", org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); break; } case 2: { id = in_.read_ulong(); // request_id // reply_status status.value = org.omg.GIOP.ReplyStatusType_1_2.from_int(in_ .read_ulong()); if (status.value.value() > org.omg.GIOP.ReplyStatusType_1_2._NEEDS_ADDRESSING_MODE) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage) + ": invalid reply status", org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); readServiceContextList(scl); // service_context // // For GIOP 1.2, the body (if present) must be aligned on // an 8-octet boundary // if (in_._OB_pos() < size_ + 12) in_._OB_skipAlign(8); break; } default: Assert._OB_assert(false); } return id; } int readCancelRequestHeader() { Assert._OB_assert(type_ == org.omg.GIOP.MsgType_1_1.CancelRequest); int id = in_.read_ulong(); // request_id return id; } int readLocateRequestHeader(org.omg.GIOP.TargetAddressHolder target) { Assert._OB_assert(type_ == org.omg.GIOP.MsgType_1_1.LocateRequest); int id = 0; switch (version_.minor) { case 0: case 1: { id = in_.read_ulong(); // request_id // // object_key // int keylen = in_.read_ulong(); byte[] key = new byte[keylen]; in_.read_octet_array(key, 0, keylen); target.value = new org.omg.GIOP.TargetAddress(); target.value.object_key(key); break; } case 2: { id = in_.read_ulong(); // request_id readTargetAddress(target); // target break; } default: Assert._OB_assert(false); } return id; } // Not currently used int readLocateReplyHeader(org.omg.GIOP.LocateStatusType_1_2Holder status) { Assert._OB_assert(type_ == org.omg.GIOP.MsgType_1_1.LocateReply); int id = 0; switch (version_.minor) { case 0: case 1: { id = in_.read_ulong(); // request_id // locate_status status.value = org.omg.GIOP.LocateStatusType_1_2.from_int(in_ .read_ulong()); if (status.value.value() > org.omg.GIOP.LocateStatusType_1_2._OBJECT_FORWARD) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage) + ": invalid locate reply status", org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); break; } case 2: { id = in_.read_ulong(); // request_id // locate_status status.value = org.omg.GIOP.LocateStatusType_1_2.from_int(in_ .read_ulong()); if (status.value.value() > org.omg.GIOP.LocateStatusType_1_2._LOC_NEEDS_ADDRESSING_MODE) throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage) + ": invalid locate reply status", org.apache.yoko.orb.OB.MinorCodes.MinorUnknownMessage, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); // // Do NOT align a locate reply body on an 8-octet boundary // break; } default: Assert._OB_assert(false); } return id; } // ---------------------------------------------------------------------- // GIOPIncomingMessage public member implementations // ---------------------------------------------------------------------- public static void setMaxMessageSize(int max) { maxMessageSize_ = max; } }
6,274
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CollocatedServer.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import java.util.logging.Level; import java.util.logging.Logger; final public class CollocatedServer extends Server implements UpcallReturn { static final Logger logger = Logger.getLogger(CollocatedServer.class.getName()); // // The next request ID and the corresponding mutex // private int nextRequestId_; private java.lang.Object nextRequestIdMutex_ = new java.lang.Object(); // // The call map // private java.util.Hashtable callMap_; // // True if destroy() was called // private boolean destroy_; // // True if holding // private boolean hold_; // // The object adapter interface // private OAInterface oaInterface_; // ---------------------------------------------------------------------- // CollocatedServer private and protected member implementations // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // CollocatedServer package member implementations // ---------------------------------------------------------------------- public CollocatedServer(OAInterface oaInterface, int concModel) { super(concModel); nextRequestId_ = 0; callMap_ = new java.util.Hashtable(13); destroy_ = false; hold_ = true; oaInterface_ = oaInterface; } // ---------------------------------------------------------------------- // CollocatedClient public member implementations // ---------------------------------------------------------------------- // // Destroy the server // public synchronized void destroy() { // // Don't destroy twice // if (destroy_) return; // // Set the destroy flag // destroy_ = true; // // Set the status of all downcalls, and empty the call map // java.util.Enumeration e = callMap_.keys(); while (e.hasMoreElements()) { Downcall down = (Downcall) callMap_.get(e.nextElement()); Assert._OB_assert(down != null); Assert._OB_assert(down.pending()); down.setFailureException(new org.omg.CORBA.INITIALIZE( "ORB has been destroyed", org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO)); } callMap_.clear(); // // Notify everyone of the state transition // notifyAll(); } // // Hold any new requests that arrive for the Server // public synchronized void hold() { Assert._OB_assert(!destroy_); logger.fine("Collocated server placed in hold state"); hold_ = true; // // Notify everyone of the state transition // notifyAll(); } // // Dispatch any requests that arrive for the Server // public synchronized void activate() { Assert._OB_assert(!destroy_); logger.fine("Collocated server activated"); hold_ = false; // // Notify everyone of the state transition // notifyAll(); } // // Called to emit downcalls // public boolean send(Downcall down, boolean b) { logger.fine("Sending a request"); // // We need a state monitor if the request is dispatched in a // separate thread. // // TODO: If we had a method to query for whether a separate // dispatch thread is used, we could avoid initializing the // state monitor when it is not needed. // down.allowWaiting(); Upcall up; synchronized (this) { // // First check whether we're destroyed or on hold // while (hold_ && !destroy_) { try { logger.fine("Waiting for hold to be released"); wait(); } catch (InterruptedException ex) { } } if (destroy_) { down.setFailureException(new org.omg.CORBA.TRANSIENT( "Collocated server has already been destroyed", 0, org.omg.CORBA.CompletionStatus.COMPLETED_NO)); return true; } // // Collect the Upcall data // org.apache.yoko.orb.OCI.ProfileInfo profileInfo = down.profileInfo(); int reqId = down.requestId(); String op = down.operation(); org.apache.yoko.orb.CORBA.OutputStream out = down.output(); org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); buf.consume(out._OB_buffer()); org.omg.IOP.ServiceContext[] requestSCL = down.getRequestSCL(); // // Is this a locate request? // if (op.charAt(0) == '_' && op.equals("_locate")) { org.omg.IOP.IORHolder ior = new org.omg.IOP.IORHolder(); switch (oaInterface_.findByKey(profileInfo.key, ior)) { case org.apache.yoko.orb.OB.OAInterface.UNKNOWN_OBJECT: down .setSystemException(new org.omg.CORBA.OBJECT_NOT_EXIST()); break; case org.apache.yoko.orb.OB.OAInterface.OBJECT_HERE: org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf, 0, false); down.setNoException(in); break; case org.apache.yoko.orb.OB.OAInterface.OBJECT_FORWARD: down.setLocationForward(ior.value, false); break; case org.apache.yoko.orb.OB.OAInterface.OBJECT_FORWARD_PERM: down.setLocationForward(ior.value, true); break; default: Assert._OB_assert(false); } return true; } if (down.responseExpected()) { // // Put the Downcall in the call map // callMap_.put(new Integer(reqId), down); // // From here on, we consider the Downcall as pending // down.setPending(); up = oaInterface_.createUpcall(this, profileInfo, null, reqId, op, new org.apache.yoko.orb.CORBA.InputStream(buf, 0, false), requestSCL); } else { // // This is a oneway call, and if there was no exception so // far, everything is fine // down.setNoException(null); up = oaInterface_.createUpcall(null, profileInfo, null, reqId, op, new org.apache.yoko.orb.CORBA.InputStream(buf, 0, false), requestSCL); } } // // Invoke the upcall // // Note: This must be done *outside* the synchronization, so that // nested method invocations are possible. // up.invoke(); if (down.responseExpected()) return false; else return true; } public boolean receive(Downcall down, boolean block) { logger.fine("Receiving a request"); // // Try to receive the reply // try { // // TODO: If we had a method to query for whether a // separate dispatch thread is used, we could avoid // calling waitUntilCompleted() if no such separate thread // is used, and query the state directly instead. // return down.waitUntilCompleted(block); } catch (org.omg.CORBA.SystemException ex) { synchronized (this) { callMap_.remove(new Integer(down.requestId())); down.setFailureException(ex); return true; } } } // // Send and receive downcalls with one operation (for efficiency // reasons) // public boolean sendReceive(Downcall down) { send(down, true); return receive(down, true); } // // Get a new request ID // public int requestId() { synchronized (nextRequestIdMutex_) { return nextRequestId_++; } } // // Get the usable profiles // public org.apache.yoko.orb.OCI.ProfileInfo[] getUsableProfiles( org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] policies) { return oaInterface_.getUsableProfiles(ior, policies); } public void upcallBeginReply(Upcall upcall, org.omg.IOP.ServiceContext[] replySCL) { upcall.createOutputStream(0); if (replySCL.length > 0) { synchronized (this) { Downcall down = (Downcall) callMap_.get(new Integer(upcall .requestId())); // // Might be null if the request timed out or destroyed // if (down != null) down.setReplySCL(replySCL); } } } public synchronized void upcallEndReply(Upcall upcall) { Downcall down = (Downcall) callMap_ .get(new Integer(upcall.requestId())); // // Might be null if the request timed out or destroyed // if (down != null) // Might be null if the request timed out { org.apache.yoko.orb.CORBA.OutputStream out = upcall.output(); org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); buf.consume(out._OB_buffer()); org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf, 0, false); down.setNoException(in); callMap_.remove(new Integer(down.requestId())); } } public void upcallBeginUserException(Upcall upcall, org.omg.IOP.ServiceContext[] replySCL) { upcall.createOutputStream(0); if (replySCL.length > 0) { synchronized (this) { Downcall down = (Downcall) callMap_.get(new Integer(upcall.requestId())); // // Might be null if the request timed out or destroyed // if (down != null) down.setReplySCL(replySCL); } } } public synchronized void upcallEndUserException(Upcall upcall) { Downcall down = (Downcall) callMap_ .get(new Integer(upcall.requestId())); // // Might be null if the request timed out or destroyed // if (down != null) { org.apache.yoko.orb.CORBA.OutputStream out = upcall.output(); org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); buf.consume(out._OB_buffer()); org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf, 0, false); down.setUserException(in); callMap_.remove(new Integer(down.requestId())); } } // // NOTE: Not used in Java // public void upcallUserException(Upcall upcall, org.omg.CORBA.UserException ex, org.omg.IOP.ServiceContext[] replySCL) { // // We marshal to preserve 100% location transparency. If we would // set the exception in the Downcall directly as shown below, then // we wouldn't get an UNKNOWN exception if we're calling from the // DII without setting the exception TypeCode. // /* * synchronized(this) { Downcall down = (Downcall)callMap_.get(new * Integer(upcall.requestId())); * // // Might be null if the request timed out or destroyed // if(down != * null) { if(replySCL.length > 0) down.setReplySCL(replySCL); * down.setUserException(ex); callMap_.remove(new * Integer(down.requestId()); } } */ upcallBeginUserException(upcall, replySCL); org.apache.yoko.orb.CORBA.OutputStream out = upcall.output(); try { // // Cannot marshal the exception in Java without the helper // // ex._OB_marshal(out); Assert._OB_assert(false); } catch (org.omg.CORBA.SystemException e) { try { upcall.marshalEx(e); } catch (LocationForward f) { Assert._OB_assert(ex); // shouldn't happen } } upcallEndUserException(upcall); } public synchronized void upcallSystemException(Upcall upcall, org.omg.CORBA.SystemException ex, org.omg.IOP.ServiceContext[] replySCL) { Downcall down = (Downcall) callMap_ .get(new Integer(upcall.requestId())); // // Might be null if the request timed out or destroyed // if (down != null) { if (replySCL.length > 0) down.setReplySCL(replySCL); down.setSystemException(ex); callMap_.remove(new Integer(down.requestId())); } } public synchronized void upcallForward(Upcall upcall, org.omg.IOP.IOR ior, boolean perm, org.omg.IOP.ServiceContext[] replySCL) { Downcall down = (Downcall) callMap_ .get(new Integer(upcall.requestId())); // // Might be null if the request timed out or destroyed // if (down != null) { if (replySCL.length > 0) down.setReplySCL(replySCL); down.setLocationForward(ior, perm); callMap_.remove(new Integer(down.requestId())); } } /** * no need to send code set and code base service contexts to ourselves * @return */ public boolean replySent() { return true; } }
6,275
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DowncallStub.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import static org.apache.yoko.orb.OCI.GiopVersion.GIOP1_2; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import org.omg.CORBA.BAD_INV_ORDER; import org.omg.CORBA.BooleanHolder; import org.omg.CORBA.COMM_FAILURE; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.ExceptionList; import org.omg.CORBA.NO_RESPONSE; import org.omg.CORBA.NVList; import org.omg.CORBA.NamedValue; import org.omg.CORBA.OBJECT_NOT_EXIST; import org.omg.CORBA.ORB; import org.omg.CORBA.Policy; import org.omg.CORBA.SystemException; import org.omg.CORBA.TRANSIENT; import org.omg.CORBA.TypeCode; import org.omg.CORBA.UserException; import org.omg.CORBA.portable.ApplicationException; import org.omg.CORBA.portable.OutputStream; import org.omg.CORBA.portable.RemarshalException; import org.omg.GIOP.MessageHeader_1_1; import org.omg.GIOP.MessageHeader_1_2Helper; import org.omg.GIOP.MsgType_1_1; import org.omg.GIOP.RequestHeader_1_2; import org.omg.GIOP.RequestHeader_1_2Helper; import org.omg.IOP.INVOCATION_POLICIES; import org.omg.IOP.IOR; import org.omg.IOP.ServiceContext; import org.omg.IOP.ServiceContextListHolder; import org.omg.MessageRouting.MessageBody; import org.omg.MessageRouting.PersistentRequest; import org.omg.MessageRouting.PersistentRequestRouter; import org.omg.MessageRouting.ReplyDestination; import org.omg.MessageRouting.ReplyDisposition; import org.omg.MessageRouting.RequestInfo; import org.omg.MessageRouting.RequestMessage; import org.omg.MessageRouting.Router; import org.omg.MessageRouting.RouterListHolder; import org.omg.Messaging.PolicyValue; import org.omg.Messaging.PolicyValueSeqHelper; import org.omg.Messaging.PolicyValueSeqHolder; import org.omg.Messaging.ReplyHandler; // // DowncallStub is equivalent to the C++ class OB::MarshalStubImpl // public final class DowncallStub { static final Logger logger = Logger.getLogger(DowncallStub.class.getName()); // // The ORBInstance object // private ORBInstance orbInstance_; // // The IOR and the original IOR // private IOR IOR_; private IOR origIOR_; // // The list of policies // private RefCountPolicyList policies_; // // All client/profile pairs // private Vector<ClientProfilePair> clientProfilePairs_; // // We need a class to carry the DowncallStub and Downcall across // a portable stub invocation // private class InvocationContext { DowncallStub downcallStub; Downcall downcall; } // ------------------------------------------------------------------ // Private and protected member implementations // ------------------------------------------------------------------ private synchronized Client getClientProfilePair(org.apache.yoko.orb.OCI.ProfileInfoHolder profileInfo) throws FailureException { // // Lazy initialization of the client/profile pairs // if (clientProfilePairs_ == null) { // // Get all clients that can be used // ClientManager clientManager = orbInstance_.getClientManager(); clientProfilePairs_ = clientManager.getClientProfilePairs(IOR_, policies_.value); } // // If we can't get any client/profile pairs, set and raise the // failure exception, and let the stub handle this. // if (clientProfilePairs_.isEmpty()) { CoreTraceLevels coreTraceLevels = orbInstance_.getCoreTraceLevels(); if (coreTraceLevels.traceRetry() >= 2) { logger.fine("retry: no profiles available"); } throw new FailureException(new TRANSIENT(org.apache.yoko.orb.OB.MinorCodes.describeTransient(org.apache.yoko.orb.OB.MinorCodes.MinorNoUsableProfileInIOR), org.apache.yoko.orb.OB.MinorCodes.MinorNoUsableProfileInIOR, CompletionStatus.COMPLETED_NO)); } ClientProfilePair clientProfilePair = (ClientProfilePair) clientProfilePairs_.elementAt(0); profileInfo.value = clientProfilePair.profile; return clientProfilePair.client; } private void destroy() { // // If the ORB has been destroyed then the clientManager can be nil // ClientManager clientManager = orbInstance_.getClientManager(); if (clientManager != null && clientProfilePairs_ != null) { for (ClientProfilePair pair: clientProfilePairs_) { clientManager.releaseClient(pair.client); } } clientProfilePairs_.removeAllElements(); } protected void finalize() throws Throwable { destroy(); super.finalize(); } // ------------------------------------------------------------------ // Public member implementations // ------------------------------------------------------------------ public DowncallStub(ORBInstance orbInstance, IOR ior, IOR origIOR, RefCountPolicyList policies) { clientProfilePairs_ = null; // // Save the ORBInstance object // orbInstance_ = orbInstance; // // Save the IOR // IOR_ = ior; origIOR_ = origIOR; // // Save the policies // policies_ = policies; } // // Operations to create new Downcall objects // public Downcall createDowncall(String op, boolean resp) throws FailureException { org.apache.yoko.orb.OCI.ProfileInfoHolder profile = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); Client client = getClientProfilePair(profile); Assert._OB_assert(client != null); if (!policies_.interceptor) { return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); } PIManager piManager = orbInstance_.getPIManager(); if (piManager.haveClientInterceptors()) { return new PIDowncall(orbInstance_, client, profile.value, policies_, op, resp, IOR_, origIOR_, piManager); } else { return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); } } public Downcall createLocateRequestDowncall() throws FailureException { org.apache.yoko.orb.OCI.ProfileInfoHolder profile = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); Client client = getClientProfilePair(profile); Assert._OB_assert(client != null); // // A LocateRequest is not seen by the interceptors // return new Downcall(orbInstance_, client, profile.value, policies_, "_locate", true); } public Downcall createPIArgsDowncall(String op, boolean resp, ParameterDesc[] argDesc, ParameterDesc retDesc, TypeCode[] exceptionTC) throws FailureException { org.apache.yoko.orb.OCI.ProfileInfoHolder profile = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); Client client = getClientProfilePair(profile); Assert._OB_assert(client != null); if (!policies_.interceptor) return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); PIManager piManager = orbInstance_.getPIManager(); if (piManager.haveClientInterceptors()) { return new PIArgsDowncall(orbInstance_, client, profile.value, policies_, op, resp, IOR_, origIOR_, piManager, argDesc, retDesc, exceptionTC); } else { return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); } } public Downcall createPIDIIDowncall(String op, boolean resp, NVList args, NamedValue result, ExceptionList exceptions) throws FailureException { org.apache.yoko.orb.OCI.ProfileInfoHolder profile = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); Client client = getClientProfilePair(profile); Assert._OB_assert(client != null); if (!policies_.interceptor) return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); PIManager piManager = orbInstance_.getPIManager(); if (piManager.haveClientInterceptors()) { return new PIDIIDowncall(orbInstance_, client, profile.value, policies_, op, resp, IOR_, origIOR_, piManager, args, result, exceptions); } else { return new Downcall(orbInstance_, client, profile.value, policies_, op, resp); } } // // Marshalling interception points // public org.apache.yoko.orb.CORBA.OutputStream preMarshal(Downcall down) throws LocationForward, FailureException { return down.preMarshal(); } public void marshalEx(Downcall down, SystemException ex) throws LocationForward, FailureException { down.marshalEx(ex); } public void postMarshal(Downcall down) throws LocationForward, FailureException { down.postMarshal(); } // // Methods to invoke requests and pick up replies // public void locate(Downcall down) throws LocationForward, FailureException { down.locate(); } public void request(Downcall down) throws LocationForward, FailureException { down.request(); } public void oneway(Downcall down) throws LocationForward, FailureException { down.oneway(); } public void deferred(Downcall down) throws LocationForward, FailureException { down.deferred(); } public void response(Downcall down) throws LocationForward, FailureException { down.response(); } public boolean poll(Downcall down) throws LocationForward, FailureException { return down.poll(); } // // Unmarshalling interception points // public org.apache.yoko.orb.CORBA.InputStream preUnmarshal(Downcall down) throws LocationForward, FailureException { return down.preUnmarshal(); } public org.apache.yoko.orb.CORBA.InputStream preUnmarshal(Downcall down, BooleanHolder uex) throws LocationForward, FailureException { org.apache.yoko.orb.CORBA.InputStream in = down.preUnmarshal(); uex.value = down.userException(); return in; } public void unmarshalEx(Downcall down, SystemException ex) throws LocationForward, FailureException { down.unmarshalEx(ex); } public void postUnmarshal(Downcall down) throws LocationForward, FailureException { down.postUnmarshal(); } // // Operations for handling user exceptions // public String unmarshalExceptionId(Downcall down) { return down.unmarshalExceptionId(); } public void setUserException(Downcall down, UserException ex, String exId) { down.setUserException(ex, exId); } public void setUserException(Downcall down, UserException ex) { down.setUserException(ex); } // // Handle a FailureException // public synchronized void handleFailureException(Downcall down, FailureException ex) throws FailureException { // // Only called if there is really a failure // Assert._OB_assert(ex.exception != null); // // If there was a failure, release the client and remove the // faulty client/profile pair, whether we retry or not // Client client = down.client(); org.apache.yoko.orb.OCI.ProfileInfo profile = down.profileInfo(); final ClientManager clientManager = orbInstance_.getClientManager(); // // Make sure the ORB has not been destroyed // if (clientManager == null) throw new BAD_INV_ORDER( MinorCodes.describeBadInvOrder( org.apache.yoko.orb.OB.MinorCodes.MinorShutdownCalled), org.apache.yoko.orb.OB.MinorCodes.MinorShutdownCalled, CompletionStatus.COMPLETED_NO); for (ClientProfilePair pair : clientProfilePairs_) { if (pair.client == client && pair.profile == profile) { clientManager.releaseClient(pair.client); clientProfilePairs_.remove(pair); break; } } // // We only retry upon COMM_FAILURE, TRANSIENT, and NO_RESPONSE // try { throw ex.exception; } catch (COMM_FAILURE|TRANSIENT|NO_RESPONSE forceRetry) { } catch (SystemException systemException) { throw ex; // Not "throw e;"! } // // We can't retry if RETRY_STRICT or RETRY_NEVER is set and the // completion status is not COMPLETED_NO // if (policies_.retry.mode != RETRY_ALWAYS.value && ex.exception.completed != CompletionStatus.COMPLETED_NO) { throw ex; } // // If no client/profile pairs are left, we cannot retry either // if (clientProfilePairs_.isEmpty()) { logger.log(Level.FINE, "no profiles left to try", ex.exception); throw ex; } // // OK, let's continue with the next profile // logger.log(Level.FINE, "trying next profile", ex.exception); } public boolean locate_request() throws LocationForward, FailureException { logger.fine("performing a locate_request"); while (true) { org.apache.yoko.orb.OB.Downcall down = createLocateRequestDowncall(); try { try { // // Get the client and force a binding // Client client = down.client(); client.bind(policies_.connectTimeout); // // If the LocateRequest policy is false, then return now // if (!policies_.locateRequest) { logger.fine("LocateRequest policy is false, returning true"); return true; } // // If the client doesn't support twoway invocations, // then silently pretend the locate request succeeded // if (!client.twoway()) { logger.fine("Twoway invocations not supported, returning true"); return true; } } catch (SystemException ex) { logger.log(Level.FINE, "Exception occurred during locate request", ex); throw new FailureException(ex); } preMarshal(down); postMarshal(down); locate(down); preUnmarshal(down); postUnmarshal(down); logger.fine("Object located"); return true; } catch (OBJECT_NOT_EXIST ex) { logger.log(Level.FINE, "Object does not exist", ex); return false; } catch (FailureException ex) { logger.log(Level.FINE, "Object lookup failure", ex); handleFailureException(down, ex); } } } public org.apache.yoko.orb.OCI.ConnectorInfo get_oci_connector_info() { try { org.apache.yoko.orb.OCI.ProfileInfoHolder profileInfo = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); org.apache.yoko.orb.OB.Client client = getClientProfilePair(profileInfo); org.apache.yoko.orb.OB.Assert._OB_assert(client != null); return client.connectorInfo(); } catch (org.apache.yoko.orb.OB.FailureException ex) { Assert._OB_assert(ex); return null; // The compiler needs this } } public org.apache.yoko.orb.OCI.TransportInfo get_oci_transport_info() { try { org.apache.yoko.orb.OCI.ProfileInfoHolder profileInfo = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); org.apache.yoko.orb.OB.Client client = getClientProfilePair(profileInfo); org.apache.yoko.orb.OB.Assert._OB_assert(client != null); return client.transportInfo(); } catch (org.apache.yoko.orb.OB.FailureException ex) { Assert._OB_assert(ex); return null; // The compiler needs this } } // // Prepare a request from a portable stub // public org.apache.yoko.orb.CORBA.OutputStream setupRequest( org.omg.CORBA.Object self, String operation, boolean responseExpected) throws LocationForward, FailureException { while (true) { org.apache.yoko.orb.OB.Downcall downcall = createDowncall( operation, responseExpected); try { org.apache.yoko.orb.CORBA.OutputStream out = preMarshal(downcall); // // The InvocationContext is associated with the OutputStream // and retrieved by invoke() // InvocationContext ctx = new InvocationContext(); ctx.downcallStub = this; ctx.downcall = downcall; out._OB_invocationContext(ctx); out._OB_ORBInstance(this._OB_getORBInstance()); return out; } catch (FailureException ex) { handleFailureException(downcall, ex); } } } // // Prepare a polling request from a portable stub // // public org.apache.yoko.orb.CORBA.OutputStream public org.apache.yoko.orb.OB.CodeConverters setupPollingRequest( ServiceContextListHolder sclHolder, org.apache.yoko.orb.CORBA.OutputStreamHolder out) throws FailureException { // // Create buffer to contain out marshalable data // org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); // // Obtain information regarding our target // org.apache.yoko.orb.OCI.ProfileInfoHolder info = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); Client client = getClientProfilePair(info); out.value = new org.apache.yoko.orb.CORBA.OutputStream(buf, client.codeConverters(), GIOP1_2); sclHolder.value = client.getAMIRouterSCL(); // // Be sure to add the invocation context before returning // InvocationContext ctx = new InvocationContext(); ctx.downcallStub = this; ctx.downcall = null; out.value._OB_invocationContext(ctx); return client.codeConverters(); } // // Creates an output stream that holds an AMI router request. Note // that this needs to be done in two parts. The first (this method) // creates the initial stream and writes the request header. The // second will complete the request by writing the message header into // the stream (this needs to be done after we write the requests // parameters) // public GIOPOutgoingMessage AMIRouterPreMarshal(String operation, boolean responseExpected, org.apache.yoko.orb.CORBA.OutputStreamHolder out, org.apache.yoko.orb.OCI.ProfileInfoHolder info) throws FailureException { // // Create buffer to contain our marshalable data // org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer( 12); buf.pos(12); // // Obtain information regarding our target // Client client = getClientProfilePair(info); out.value = new org.apache.yoko.orb.CORBA.OutputStream(buf, client.codeConverters(), GIOP1_2); ServiceContext[] scl = client.getAMIRouterSCL(); GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance_, out.value, info.value); // // Put the request header into the stream // outgoing.writeRequestHeader(client.getNewRequestID(), operation, responseExpected, scl); return outgoing; } public void AMIRouterPostMarshal(GIOPOutgoingMessage outgoing, org.apache.yoko.orb.CORBA.OutputStreamHolder out) { int pos = out.value._OB_pos(); out.value._OB_pos(0); outgoing.writeMessageHeader(MsgType_1_1.Request, false, pos - 12); out.value._OB_pos(pos); // // The InvocationContext is associated with the OutputStream // and retrieved by ami_*_request // InvocationContext ctx = new InvocationContext(); ctx.downcallStub = this; ctx.downcall = null; // no downcall associated with an AMI request out.value._OB_invocationContext(ctx); } // // Invoke a request from a portable stub // public org.apache.yoko.orb.CORBA.InputStream invoke( org.omg.CORBA.Object self, org.apache.yoko.orb.CORBA.OutputStream out) throws ApplicationException, RemarshalException, LocationForward, FailureException { // // We should have an InvocationContext associated with the // OutputStream // org.apache.yoko.orb.CORBA.OutputStream o = out; InvocationContext ctx = (InvocationContext) o._OB_invocationContext(); Assert._OB_assert(ctx != null); // // If the DowncallStub has changed, then remarshal // if (ctx.downcallStub != this) { throw new RemarshalException(); } Downcall down = ctx.downcall; // // No while loop here - if we need to reinvoke, we must raise // RemarshalException // try { down.postMarshal(); boolean response = down.responseExpected(); if (response) { down.request(); } else { down.oneway(); } if (response) { org.apache.yoko.orb.CORBA.InputStream in = down.preUnmarshal(); if (down.userException()) { String id = null; try { // // Extract the exception's repository ID // id = down.unmarshalExceptionId(); } catch (SystemException ex) { down.unmarshalEx(ex); } // // We're using portable stubs, so we'll never // be given the user exception instance. Therefore, // we might as well invoke the interceptors now. // down.setUserException(id); down.postUnmarshal(); throw new ApplicationException(id, in); } else { // // We're using portable stubs, so we'll never // know the unmarshalled results. Therefore, // we might as well invoke the interceptors now. // down.postUnmarshal(); return in; } } else { down.preUnmarshal(); down.postUnmarshal(); return null; } } catch (FailureException ex) { handleFailureException(down, ex); } // // If we reach this point, then we need to reinvoke // throw new RemarshalException(); } public org.omg.CORBA.Object getAMIPollTarget() { // // Since we don't have access to the IOR information in the // generated stub, we will call this method to create the target // object for a polling request // org.apache.yoko.orb.OB.ObjectFactory objectFactory = orbInstance_.getObjectFactory(); return objectFactory.createObject(IOR_); } public PersistentRequest ami_poll_request(OutputStream out, String operation, ServiceContext[] scl) throws RemarshalException { // // setup the ORBInstance // // poller._OB_ORBInstance(orbInstance_); Assert._OB_assert(out != null); // // We should have an InvocationContext associated with the OutputStream // org.apache.yoko.orb.CORBA.OutputStream o = (org.apache.yoko.orb.CORBA.OutputStream) out; InvocationContext ctx = (InvocationContext) o._OB_invocationContext(); Assert._OB_assert(ctx != null); // // If the DowncallStub has changed, then remarshal // if (ctx.downcallStub != this) throw new RemarshalException(); // // Obtain the ORB // ORB orb = orbInstance_.getORB(); Assert._OB_assert(orb != null); // // Obtain the PersistentRequestRouter // PersistentRequestRouter router = org.apache.yoko.orb.OB.MessageRoutingUtil.getPersistentRouterFromConfig(orbInstance_); org.apache.yoko.orb.OB.Assert._OB_assert(router != null); // // Obtain information regarding our target // org.apache.yoko.orb.OCI.ProfileInfoHolder info = new org.apache.yoko.orb.OCI.ProfileInfoHolder(); info.value = null; try { getClientProfilePair(info); } catch (org.apache.yoko.orb.OB.FailureException ex) { throw new RemarshalException(); } // // Get the profile index // short index = (short) info.value.index; // // Create the router to_visit list // RouterListHolder to_visit = new RouterListHolder(); to_visit.value = new Router[0]; org.apache.yoko.orb.OB.MessageRoutingUtil.getRouterListFromComponents(orbInstance_, info.value, to_visit); // // Obtain the target objects // org.apache.yoko.orb.OB.ObjectFactory objectFactory = orbInstance_.getObjectFactory(); org.omg.CORBA.Object target = objectFactory.createObject(IOR_); // // Populate the RequestMessage payload // RequestMessage payload = new RequestMessage(); // payload.service_contexts = new ServiceContext[0]; // // XXX // payload.service_contexts = scl; payload.giop_version = new org.omg.GIOP.Version(); payload.giop_version.major = info.value.major; payload.giop_version.minor = info.value.minor; payload.response_flags = 1; payload.reserved = new byte[3]; payload.reserved[0] = 0; payload.reserved[1] = 0; payload.reserved[2] = 0; payload.operation = operation; payload.object_key = new byte[info.value.key.length]; System.arraycopy(info.value.key, 0, payload.object_key, 0, info.value.key.length); o._OB_pos(0); org.apache.yoko.orb.OCI.Buffer buf = o._OB_buffer(); MessageBody messageBody = new MessageBody(); messageBody.byte_order = false; // Java is always false messageBody.body = new byte[buf.rest_length()]; System.arraycopy(buf.data(), buf.pos(), messageBody.body, 0, buf.rest_length()); payload.body = messageBody; // // Empty QoS list // Policy[] qosList = new Policy[0]; // // Create a new Persistent request // PersistentRequest request = router.create_persistent_request(index, to_visit.value, target, qosList, payload); // // Return the persistent request back to the stub // return request; } public boolean ami_callback_request(OutputStream out, ReplyHandler reply, org.apache.yoko.orb.OCI.ProfileInfo info) throws RemarshalException { // // We should have an InvocationContext associated with the // OutputStream // org.apache.yoko.orb.CORBA.OutputStream o = (org.apache.yoko.orb.CORBA.OutputStream) out; InvocationContext ctx = (InvocationContext) o._OB_invocationContext(); Assert._OB_assert(ctx != null); // // If the DowncallStub has changed, then remarshal // if (ctx.downcallStub != this) throw new RemarshalException(); org.apache.yoko.orb.CORBA.InputStream tmpIn = (org.apache.yoko.orb.CORBA.InputStream) out.create_input_stream(); // // Unmarshal the message header // MessageHeader_1_1 msgHeader = MessageHeader_1_2Helper.read(tmpIn); // // Check the GIOP version // if (!(msgHeader.GIOP_version.major >= 1 && msgHeader.GIOP_version.minor >= 2)) { // // Report error - throw exception? // return false; } // // Check the message type // if (msgHeader.message_type != (byte) MsgType_1_1._Request) { // // Report error - throw exception // return false; } // // Create and populate a RequestInfo to send to the router // RequestInfo requestInfo = new RequestInfo(); // // Unmarshal the request header // RequestHeader_1_2 requestHeader = RequestHeader_1_2Helper.read(tmpIn); // // Create and populate a RequestInfo structure to send to the // Router // RouterListHolder configRouterList = new RouterListHolder(); configRouterList.value = new Router[0]; // // Populate the configRouterList // org.apache.yoko.orb.OB.MessageRoutingUtil.getRouterListFromComponents(orbInstance_, info, configRouterList); requestInfo.visited = new Router[0]; requestInfo.to_visit = new Router[0]; // // Get the target for this request // org.apache.yoko.orb.OB.ObjectFactory objectFactory = orbInstance_.getObjectFactory(); // // REVISIT: Should we be using IOR_ or origIOR_? // requestInfo.target = objectFactory.createObject(IOR_); // // Get the index of the profile being used // requestInfo.profile_index = (short) info.index; // // Get the reply destination for this request // ReplyDestination replyDest = new ReplyDestination(); replyDest.handler_type = ReplyDisposition.TYPED; replyDest.handler = reply; requestInfo.reply_destination = replyDest; // // Get the selected qos for this request // PolicyValueSeqHolder invocPoliciesHolder = new PolicyValueSeqHolder(); invocPoliciesHolder.value = new PolicyValue[0]; org.apache.yoko.orb.OB.MessageRoutingUtil.getInvocationPolicyValues(policies_, invocPoliciesHolder); requestInfo.selected_qos = invocPoliciesHolder.value; // // Create payload (RequestMessage) for this request // RequestMessage requestMessage = new RequestMessage(); requestMessage.giop_version = new org.omg.GIOP.Version(); requestMessage.giop_version.major = info.major; requestMessage.giop_version.minor = info.minor; // // Get the service contexts for this request // requestMessage.service_contexts = requestHeader.service_context; // // Add the invocation policies service context for this request. // Note that this can change from request to request // ServiceContext invocPoliciesSC = new ServiceContext(); invocPoliciesSC.context_id = INVOCATION_POLICIES.value; // // Create an output stream an write the PolicyValueSeq // if (invocPoliciesHolder.value != null) { org.apache.yoko.orb.OCI.Buffer scBuf = new org.apache.yoko.orb.OCI.Buffer(); org.apache.yoko.orb.CORBA.OutputStream scOut = new org.apache.yoko.orb.CORBA.OutputStream( scBuf); scOut._OB_writeEndian(); PolicyValueSeqHelper.write(scOut, invocPoliciesHolder.value); invocPoliciesSC.context_data = new byte[scOut._OB_pos()]; System.arraycopy(invocPoliciesSC.context_data, 0, scBuf.data(), 0, scBuf.length()); } // // Add the service context to the list of current service contexts // int scLength = requestMessage.service_contexts.length; ServiceContext[] scList = new ServiceContext[scLength + 1]; System.arraycopy(requestMessage.service_contexts, 0, scList, 0, scLength); scList[scLength] = invocPoliciesSC; // // Get the response flags for the request // requestMessage.response_flags = requestHeader.response_flags; // // Reserved octets // requestMessage.reserved = new byte[3]; requestMessage.reserved[0] = requestHeader.reserved[0]; requestMessage.reserved[1] = requestHeader.reserved[1]; requestMessage.reserved[2] = requestHeader.reserved[2]; // // Get the object key for the request // int keyLen = info.key.length; requestMessage.object_key = new byte[keyLen]; System.arraycopy(info.key, 0, requestMessage.object_key, 0, keyLen); // // Get the operation name for the request // requestMessage.operation = requestHeader.operation; // // Get the body of the request message // MessageBody messageBody = new MessageBody(); // // Java is always big endian // messageBody.byte_order = false; org.apache.yoko.orb.OCI.Buffer buf = tmpIn._OB_buffer(); // // Align to an 8 byte boundary if we have something left // if (buf.rest_length() > 0) { buf.pos((buf.pos() + 7) & ~7); } // // Copy in the rest of the message body // messageBody.body = new byte[buf.rest_length()]; System.arraycopy(buf.data_, buf.pos(), messageBody.body, 0, buf.rest_length()); requestMessage.body = messageBody; // // Add the payload to the RequestInfo // requestInfo.payload = requestMessage; // // Now we have to try send the request to a router // boolean delivered = false; int numRouters = configRouterList.value.length; for (int i = numRouters - 1; (delivered == false) && (i >= 0); --i) { Router curRouter = configRouterList.value[i]; // // We only add the routers that we have attempted to contact to // the to_visit list. This ensures that if a router accepts // the request, then the lower priority routers are not added // int curLength = requestInfo.to_visit.length; Router[] toVisit = new Router[curLength + 1]; if (curLength > 0) { System.arraycopy(requestInfo.to_visit, 0, toVisit, 1, curLength); } toVisit[0] = curRouter; requestInfo.to_visit = toVisit; try { curRouter.send_request(requestInfo); // // Success: stop processing // delivered = true; } catch (SystemException ex) { logger.log(Level.FINE, "Failed to contact router: " + ex.getMessage(), ex); // // Failure: try the next router in the list // } } // // return whether we were successful or not // return delivered; } // // Need to be able to access the ORB instance from a stub for AMI // polling // public ORBInstance _OB_getORBInstance() { return orbInstance_; } }
6,276
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/FileURLScheme_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.URLRegistry; import org.apache.yoko.orb.OB.URLScheme; public class FileURLScheme_impl extends org.omg.CORBA.LocalObject implements URLScheme { private boolean relative_; private URLRegistry registry_; // ------------------------------------------------------------------ // FileURLScheme_impl constructor // ------------------------------------------------------------------ public FileURLScheme_impl(boolean relative, URLRegistry registry) { relative_ = relative; registry_ = registry; } // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public String name() { return (relative_ ? "relfile" : "file"); } public org.omg.CORBA.Object parse_url(String url) { int startIdx; if (relative_) startIdx = 8; // skip "relfile:" else startIdx = 5; // skip "file:" int len = url.length(); // // Allow up to three leading '/''s to match commonly used forms // of the "file:" URL scheme // for (int n = 0; startIdx < len && n < 3; n++, startIdx++) if (url.charAt(startIdx) != '/') break; if (startIdx >= len) throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart) + ": no file name specified", org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart, org.omg.CORBA.CompletionStatus.COMPLETED_NO); String fileName; if (relative_) fileName = ""; else fileName = "/"; fileName += URLUtil.unescapeURL(url.substring(startIdx)); try { java.io.FileInputStream file = new java.io.FileInputStream(fileName); java.io.BufferedReader in = new java.io.BufferedReader( new java.io.InputStreamReader(file)); String ref = in.readLine(); file.close(); return registry_.parse_url(ref); } catch (java.io.IOException ex) { throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart) + ": file error", org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } } public void destroy() { registry_ = null; } }
6,277
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionStrategyHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/UnknownExceptionStrategy:1.0 // final public class UnknownExceptionStrategyHolder implements org.omg.CORBA.portable.Streamable { public UnknownExceptionStrategy value; public UnknownExceptionStrategyHolder() { } public UnknownExceptionStrategyHolder(UnknownExceptionStrategy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = UnknownExceptionStrategyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { UnknownExceptionStrategyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return UnknownExceptionStrategyHelper.type(); } }
6,278
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionStrategyHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/UnknownExceptionStrategy:1.0 // final public class UnknownExceptionStrategyHelper { public static void insert(org.omg.CORBA.Any any, UnknownExceptionStrategy val) { any.insert_Object(val, type()); } public static UnknownExceptionStrategy extract(org.omg.CORBA.Any any) { if(any.type().equivalent(type())) return narrow(any.extract_Object()); throw new org.omg.CORBA.BAD_OPERATION( org.apache.yoko.orb.OB.MinorCodes .describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch), org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private static org.omg.CORBA.TypeCode typeCode_; public static org.omg.CORBA.TypeCode type() { if(typeCode_ == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "UnknownExceptionStrategy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OB/UnknownExceptionStrategy:1.0"; } public static UnknownExceptionStrategy read(org.omg.CORBA.portable.InputStream in) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static void write(org.omg.CORBA.portable.OutputStream out, UnknownExceptionStrategy val) { throw new org.omg.CORBA.MARSHAL( org.apache.yoko.orb.OB.MinorCodes .describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported), org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static UnknownExceptionStrategy narrow(org.omg.CORBA.Object val) { try { return (UnknownExceptionStrategy)val; } catch(ClassCastException ex) { } throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType), org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } }
6,279
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Logger.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import java.util.logging.Level; /** * * The Yoko message logger interface. * **/ public interface Logger { /** * Log an informational message. * * @param msg The message. * @param e An exception associated with the error. */ void info(String msg, Throwable e); /** * * Log an informational message. * * @param msg The message. * **/ void info(String msg); /** * * Log an error message. * * @param msg The error message. * **/ void error(String msg); /** * Log an error message. * * @param msg The error message. * @param e An exception associated with the error. */ void error(String msg, Throwable e); /** * * Log a warning message. * * @param msg The warning message. * **/ void warning(String msg); /** * * Log a warning message. * * @param msg The warning message. * @param e An exception associated with the warning. * **/ void warning(String msg, Throwable e); /** * * Log a debug message. * * @param msg The debug message. * **/ void debug(String msg); /** * * Log a debug message. * * @param msg The debug message. * @param e An exception associated with the warning. * **/ void debug(String msg, Throwable e); /** * Test if debug output is enabled for this logger. * * @return True if debug logging is enabled, false if debug * output is not enabled. */ boolean isDebugEnabled(); /** * * Log a trace message. * * @param category The trace category. * * @param msg The trace message. * **/ void trace(String category, String msg); /** * Log a message of the indicated level. * * @param level The message level. * @param msg The logged message. */ void log(Level level, String msg); /** * Log a message of the indicated level. * * @param level The message level. * @param msg The logged message. * @param param A single parameter object included with the message. */ void log(Level level, String msg, Object param); /** * Log a message of the indicated level. * * @param level The message level. * @param msg The logged message. * @param params An array of parameter objects logged with the message. */ void log(Level level, String msg, Object[] params); /** * Log a message of the indicated level. * * @param level The message level. * @param msg The logged message. * @param thrown An exception object included in the log. */ void log(Level level, String msg, Throwable thrown); }
6,280
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectTimeoutPolicy.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ConnectTimeoutPolicy:1.0 // /** * * The connect timeout policy. This policy can be used to specify * a maximum time limit for connection establishment. * * @see TimeoutPolicy * **/ public interface ConnectTimeoutPolicy extends ConnectTimeoutPolicyOperations, org.omg.CORBA.Policy { }
6,281
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ThreadPool.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.DispatchRequest; final class ThreadPool { private boolean destroy_ = false; // True if destroy was called private java.util.Vector requests_ = new java.util.Vector(); private ThreadGroup group_; // Thread group for the threads in the pool // // ThreadPoolDispatcher // private class Dispatcher extends Thread { private ThreadPool threadPool_; Dispatcher(ThreadGroup group, ThreadPool threadPool, int id, int n) { super(group, "Yoko:ThreadPool-" + id + ":Dispatcher-" + n); threadPool_ = threadPool; } public void run() { while (true) { DispatchRequest req = threadPool_.get(); // // ThreadPool has terminated // if (req == null) return; req.invoke(); } } } public ThreadPool(int id, int n) { // // Create a new thread group. Place each of the threads in the // pool in this new group. // group_ = new ThreadGroup("ThreadPool-" + id); // // Start all each of the threads in the pool // for (int i = 0; i < n; i++) { Thread t = new Dispatcher(group_, this, id, i); t.start(); } } protected void finalize() throws Throwable { if (!destroy_) throw new InternalError(); super.finalize(); } void destroy() { synchronized (this) { if (destroy_) return; destroy_ = true; notifyAll(); } // // Wait for all the threads in the pool to end // synchronized (group_) { while (group_.activeCount() > 0) { try { group_.wait(); } catch (InterruptedException ex) { } } // // Destroy the group // try { group_.destroy(); } catch (IllegalThreadStateException ex) { Assert._OB_assert(ex); } } } synchronized void add(DispatchRequest request) { // // If the thread pool has been destroyed then this is an // OBJ_ADAPTER error // if (destroy_) throw new org.omg.CORBA.OBJ_ADAPTER("Thread pool is destroyed"); requests_.addElement(request); notify(); } private synchronized DispatchRequest get() { while (!destroy_ && requests_.isEmpty()) { try { wait(); } catch (InterruptedException ex) { } } DispatchRequest result = null; if (!destroy_) { result = (DispatchRequest) requests_.firstElement(); requests_.removeElementAt(0); } return result; } }
6,282
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UTF16Writer.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final class UTF16Writer extends CodeSetWriter { private int Flags_ = 0; public void write_char(org.apache.yoko.orb.CORBA.OutputStream out, char v) throws org.omg.CORBA.DATA_CONVERSION { out.buf_.data_[out.buf_.pos_++] = (byte) (v & 0xff); } public void write_wchar(org.apache.yoko.orb.CORBA.OutputStream out, char v) throws org.omg.CORBA.DATA_CONVERSION { if (OB_Extras.COMPAT_WIDE_MARSHAL == true) { out.buf_.data_[out.buf_.pos_] = (byte) (v >> 8); out.buf_.data_[out.buf_.pos_ + 1] = (byte) v; } else { // // we don't support surrogate paired characters // org.apache.yoko.orb.OB.Assert._OB_assert(v < 0xD800 || v > 0xDFFF); // // if this character is the same character as the BOM, then we // need to escape it with the Big Endian BOM // if (((Flags_ & CodeSetWriter.FIRST_CHAR) != 0) && (v == (char) 0xFEFF || v == (char) 0xFFFE)) { out.buf_.data_[out.buf_.pos_++] = (byte) 0xFE; out.buf_.data_[out.buf_.pos_++] = (byte) 0xFF; } // // we always write our UTF-16 characters in Big Endian format // out.buf_.data_[out.buf_.pos_++] = (byte) (v >>> 8); out.buf_.data_[out.buf_.pos_++] = (byte) (v & 0xff); // // turn off the FIRST_CHAR flag // Flags_ &= ~CodeSetWriter.FIRST_CHAR; } } public int count_wchar(char v) { if (OB_Extras.COMPAT_WIDE_MARSHAL == false) { // // we don't support surrogate paired characters // org.apache.yoko.orb.OB.Assert._OB_assert(v < (char) 0xD800 || v > (char) 0xDFFF); // // we need to escape the first character if its a BOM // if (((Flags_ & CodeSetWriter.FIRST_CHAR) != 0) && (v == 0xFEFF || v == 0xFFFE)) return 4; } return 2; } public void set_flags(int flags) { Flags_ = flags; } }
6,283
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectionReusePolicyOperations.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ConnectionReusePolicy:1.0 // /** * * The connection reuse policy. This policy determines whether * connections may be reused or are private to specific objects. * **/ public interface ConnectionReusePolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OB/ConnectionReusePolicy/value:1.0 // /** * * If an object has a <code>ConnectionReusePolicy</code> set with * <code>value</code> set to <code>FALSE</code>, then other * object references will not be permitted to use connections * made on behalf of this object. If set to <code>TRUE</code>, * then connections are shared. The default value is * <code>TRUE</code>. * **/ boolean value(); }
6,284
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/IORDump.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Properties; public class IORDump { public static String PrintObjref(org.omg.CORBA.ORB orb, org.omg.IOP.IOR ior) { StringBuilder sb = new StringBuilder(); PrintObjref(orb, sb, ior); return sb.toString(); } static public void PrintObjref(org.omg.CORBA.ORB orb, StringBuilder sb, org.omg.IOP.IOR ior) { sb.append("type_id: ").append(ior.type_id).append('\n'); org.apache.yoko.orb.OCI.ConFactoryRegistry conFactoryRegistry = null; try { org.omg.CORBA.Object obj = orb .resolve_initial_references("OCIConFactoryRegistry"); conFactoryRegistry = org.apache.yoko.orb.OCI.ConFactoryRegistryHelper .narrow(obj); } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { Assert._OB_assert(ex); } org.apache.yoko.orb.OCI.ConFactory[] factories = conFactoryRegistry .get_factories(); for (int i = 0; i < ior.profiles.length; i++) { sb.append("Profile #" + (i + 1) + ": "); if (ior.profiles[i].tag == org.omg.IOP.TAG_MULTIPLE_COMPONENTS.value) { sb.append("multiple components"); byte[] data = ior.profiles[i].profile_data; org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer( data, data.length); org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf); in._OB_readEndian(); int cnt = in.read_ulong(); if (cnt == 0) sb.append('\n'); else { for (int j = 0; j < cnt; j++) { org.omg.IOP.TaggedComponent comp = org.omg.IOP.TaggedComponentHelper .read(in); IORUtil.describe_component(comp, sb); } } } else { int j; for (j = 0; j < factories.length; j++) { if (factories[j].tag() == ior.profiles[i].tag) { sb.append(factories[j].id()).append('\n'); String desc = factories[j] .describe_profile(ior.profiles[i]); sb.append(desc); break; } } if (j >= factories.length) { sb.append("unknown profile tag ").append(ior.profiles[i].tag).append('\n'); sb.append("profile_data: (") .append(ior.profiles[i].profile_data.length ).append(")\n"); IORUtil.dump_octets( ior.profiles[i].profile_data, sb); } } } } static public void DumpIOR(org.omg.CORBA.ORB orb, String ref, boolean hasEndian) { StringBuilder sb = new StringBuilder(); DumpIOR(orb, ref, hasEndian, sb); PrintWriter pw = new PrintWriter(System.out); pw.write(sb.toString()); pw.flush(); } static public String DumpIORToString(org.omg.CORBA.ORB orb, String ref, boolean hasEndian) { StringBuilder sb = new StringBuilder(); DumpIOR(orb, ref, hasEndian, sb); return sb.toString(); } static public void DumpIOR(org.omg.CORBA.ORB orb, String ref, boolean hasEndian, StringBuilder sb) { if (!ref.startsWith("IOR:")) { sb.append("IOR is invalid\n"); return; } byte[] data = HexConverter.asciiToOctets(ref, 4); org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer( data, data.length); org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf); boolean endian = in.read_boolean(); in._OB_swap(endian); org.omg.IOP.IOR ior = org.omg.IOP.IORHelper.read(in); sb.append("byteorder: "); if (hasEndian) sb.append((endian ? "little" : "big") + " endian\n"); else sb.append("n/a\n"); PrintObjref(orb, sb, ior); } static void usage() { System.err.println("Usage:"); System.err .println("org.apache.yoko.orb.OB.IORDump [options] [-f FILE ... | IOR ...]\n" + "\n" + "Options:\n" + "-h, --help Show this message.\n" + "-v, --version Show Yoko version.\n" + "-f Read IORs from files instead of from the\n" + " command line."); } public static int run(org.omg.CORBA.ORB orb, String[] args) throws org.omg.CORBA.UserException { // // Get options // boolean files = false; int i; for (i = 0; i < args.length && args[i].charAt(0) == '-'; i++) { if (args[i].equals("--help") || args[i].equals("-h")) { usage(); return 0; } else if (args[i].equals("--version") || args[i].equals("-v")) { System.out.println("Yoko " + Version.getVersion()); return 0; } else if (args[i].equals("-f")) { files = true; } else { System.err.println("IORDump: unknown option `" + args[i] + "'"); usage(); return 1; } } if (i == args.length) { System.err.println("IORDump: no IORs"); System.err.println(); usage(); return 1; } if (!files) { if (!args[i].startsWith("IOR:") && !args[i].startsWith("corbaloc:") && !args[i].startsWith("corbaname:") && !args[i].startsWith("file:") && !args[i].startsWith("relfile:")) { System.err.println("[No valid IOR found on the command " + "line, assuming -f]"); files = true; } } if (!files) { // // Dump all IORs given as arguments // int count = 0; for (; i < args.length; i++) { if (count > 0) System.out.println(); System.out.println("IOR #" + (++count) + ':'); try { // // The byte order can only be preserved for IOR: URLs // if (args[i].startsWith("IOR:")) DumpIOR(orb, args[i], true); else { // // Let string_to_object do the dirty work // org.omg.CORBA.Object obj = orb .string_to_object(args[i]); String s = orb.object_to_string(obj); DumpIOR(orb, s, false); } } catch (org.omg.CORBA.BAD_PARAM ex) { System.err.println("IOR is invalid"); } } } else { // // Dump all IORs from the specified files // int count = 0; for (; i < args.length; i++) { try { java.io.FileReader fin = new java.io.FileReader(args[i]); java.io.BufferedReader in = new java.io.BufferedReader(fin); String line; while ((line = in.readLine()) != null) { if (line.length() > 0) { if (count > 0) System.out.println(); System.out.println("IOR #" + (++count) + ':'); // // The byte order can only be preserved for // IOR: URLs // if (line.startsWith("IOR:")) DumpIOR(orb, line, true); else { // // Let string_to_object do the dirty work // org.omg.CORBA.Object obj = orb .string_to_object(line); String s = orb.object_to_string(obj); DumpIOR(orb, s, false); } } } } catch (java.io.FileNotFoundException ex) { System.err.println("IORDump: can't open `" + args[i] + "': " + ex); return 1; } catch (java.io.IOException ex) { System.err.println("IORDump: can't read `" + args[i] + "': " + ex); return 1; } } } return 0; } public static void main(String[] args) { java.util.Properties props = new Properties(); props.putAll(System.getProperties()); props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); int status; org.omg.CORBA.ORB orb = null; try { args = org.apache.yoko.orb.CORBA.ORB.ParseArgs(args, props, null); orb = org.omg.CORBA.ORB.init(args, props); status = run(orb, args); } catch (Exception ex) { ex.printStackTrace(); status = 1; } if (orb != null) { try { orb.destroy(); } catch (Exception ex) { ex.printStackTrace(); status = 1; } } System.exit(status); } }
6,285
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeConverterBoth.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final class CodeConverterBoth extends CodeConverterBase { // // Unicode character mapping tables // private CharMapInfo fromMap_; private CharMapInfo toMap_; // ------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------ CodeConverterBoth(CodeSetInfo fromSet, CodeSetInfo toSet, CharMapInfo fromMap, CharMapInfo toMap) { super(fromSet, toSet); fromMap_ = fromMap; toMap_ = toMap; } // ------------------------------------------------------------------ // Public member implementations // ------------------------------------------------------------------ public boolean conversionRequired() { return true; } public char convert(char v) { if (v <= (char) fromMap_.upper_bound) { v = (char) fromMap_.map_values[v]; } for (int i = 0; i <= toMap_.upper_bound; i++) { if (toMap_.map_values[i] == v) return (char) i; } return v; } }
6,286
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPClient.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.CORBA.OutputStream; import org.apache.yoko.orb.CORBA.OutputStreamHolder; import org.apache.yoko.orb.OBPortableServer.POAManager_impl; import org.apache.yoko.orb.OCI.Buffer; import org.apache.yoko.orb.OCI.Connector; import org.apache.yoko.orb.OCI.ConnectorInfo; import org.apache.yoko.orb.OCI.GiopVersion; import org.apache.yoko.orb.OCI.ProfileInfo; import org.apache.yoko.orb.OCI.Transport; import org.apache.yoko.util.Cache; import org.apache.yoko.util.Factory; import org.apache.yoko.util.Reference; import org.omg.CONV_FRAME.CodeSetContext; import org.omg.CONV_FRAME.CodeSetContextHelper; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.INITIALIZE; import org.omg.CORBA.NO_RESPONSE; import org.omg.CORBA.Policy; import org.omg.IOP.CodeSets; import org.omg.IOP.IOR; import org.omg.IOP.ServiceContext; import org.omg.PortableServer.POAManager; import org.omg.SendingContext.CodeBase; import org.omg.SendingContext.CodeBaseHelper; import javax.rmi.CORBA.ValueHandler; import java.util.ArrayList; import java.util.List; import static javax.rmi.CORBA.Util.*; import static org.apache.yoko.orb.OB.MinorCodes.*; final class GIOPClient extends Client { protected ORBInstance orbInstance_; // The ORB instance protected Connector connector_; // The connector private GIOPConnection connection_; private Reference<GIOPConnection> connectionRef; /** Codesets SC */ protected ServiceContext codeSetSC_; protected ServiceContext codeBaseSC_; protected boolean bidirWorker_; // is the worker bidir? protected volatile boolean destroy_; // True if destroy() was called // ---------------------------------------------------------------------- // GIOPClient private and protected member implementations // ---------------------------------------------------------------------- // uses the prepopulated connector_ (not connected) to do a lookup, // checking if a bidir connection alias exists... it returns it if // it does and returns null otherwise protected GIOPConnection find_bidir_worker() { try { for (POAManager poaManager : orbInstance_.getPOAManagerFactory().list()) { for (Server aServSeq : ((POAManager_impl) poaManager)._OB_getServerManager().getServers()) { GIOPConnection conn = ((GIOPServer) aServSeq)._OB_getGIOPServerStarter().getMatchingConnection(connectorInfo()); if (conn != null) return conn; } } } catch (ClassCastException ignored) {} return null; } // // Get the worker. If the bool flag is true, and no worker exists, // a new worker is created, with the timeout specified as second // parameter. // protected synchronized GIOPConnection getWorker(boolean create, final int timeout) { if (destroy_) throw new INITIALIZE(describeInitialize(MinorORBDestroyed), MinorORBDestroyed, CompletionStatus.COMPLETED_NO); if (connection_ == null) reuseInboundConnection(); // // no inbound bidir connection resolved so lookup an existing outbound connection // or create one if the request calls for it // if (connection_ == null) reuseOrCreateOutboundConnection(create, timeout); // // Lazy initialization of codeSetSC_. We don't want to // initialize codeSetSC_ in the constructor, in order to // keep creation of GIOPClients, which might later on not // be used, as light-weight as possible. // initServiceContexts(); return connection_; } private synchronized void reuseOrCreateOutboundConnection(boolean create, final int timeout) { Cache<ConnectorInfo, GIOPConnection> connCache = orbInstance_.getOutboundConnectionCache(); if (create) { connectionRef = connCache.getOrCreate(connector_.get_info(), new Factory<GIOPConnection>() { @Override public GIOPConnection create() { return createOutboundConnection(timeout); } }); } else { connectionRef = connCache.get(connector_.get_info()); } connCache.clean(); connection_ = connectionRef.get(); // // bidirWorker_ means that this connection may be used to // service requests so we need to set ourselves up as a // server (to correct map the OAInterfaces) // if (bidirWorker_) connection_.activateServerSide(); } private synchronized void reuseInboundConnection() { // // first attempt to locate a reusable bidir connection // connection_ = find_bidir_worker(); if (connection_ == null) return; connection_.activateClientSide(); // // log the reusing of the connection // if (orbInstance_.getCoreTraceLevels().traceConnections() > 0) { String msg = "reusing established bidir connection\n" + connection_.transport().get_info().describe(); orbInstance_.getLogger().trace("outgoing", msg); } } private GIOPConnectionThreaded createOutboundConnection(int t) { // // Trace connection attempt // CoreTraceLevels coreTraceLevels = orbInstance_.getCoreTraceLevels(); if (coreTraceLevels.traceConnections() > 0) { String msg = "trying to establish connection\n"; msg += "timeout: "; if (t >= 0) { msg += t; msg += "ms\n"; } else msg += "none\n"; msg += connector_.get_info().describe(); orbInstance_.getLogger().trace("outgoing", msg); } // // Create new transport, using the connector // // For symetry reasons, GIOPClientStarterThreaded should also be // added, even though these classes only have a trivial // functionality. Or perhaps the GIOPClientStarterThreaded tries to // connect() in the backgound? Just an idea... // Transport transport; if (t >= 0) { transport = connector_.connect_timeout(t); // // Was there a timeout? // if (transport == null) throw new NO_RESPONSE("Connection timeout", 0, CompletionStatus.COMPLETED_NO); } else { transport = connector_.connect(); Assert._OB_assert(transport != null); } // // Create new worker // Assert._OB_assert(concModel_ == Threaded); return new GIOPConnectionThreaded(orbInstance_, transport, this); } // initialize internal service contexts private void initServiceContexts() { if (codeSetSC_ == null) { CodeSetContext ctx = new CodeSetContext(); CodeConverters conv = codeConverters(); if (conv.outputCharConverter != null) ctx.char_data = conv.outputCharConverter.getTo().rgy_value; else ctx.char_data = CodeSetDatabase.ISOLATIN1; if (conv.outputWcharConverter != null) ctx.wchar_data = conv.outputWcharConverter.getTo().rgy_value; else ctx.wchar_data = orbInstance_.getNativeWcs(); // Create encapsulation for CONV_FRAME::CodeSetContext Buffer buf = new Buffer(); OutputStream outCSC = new OutputStream(buf); outCSC._OB_writeEndian(); CodeSetContextHelper.write(outCSC, ctx); // Create service context containing the // CONV_FRAME::CodeSetContext encapsulation codeSetSC_ = new ServiceContext(); codeSetSC_.context_id = CodeSets.value; int len = buf.length(); byte[] data = buf.data(); codeSetSC_.context_data = new byte[len]; System.arraycopy(data, 0, codeSetSC_.context_data, 0, len); } if (codeBaseSC_ == null) { ValueHandler valueHandler = createValueHandler(); CodeBase codeBase = CodeBaseHelper.narrow(valueHandler.getRunTimeCodeBase()); Buffer buf = new Buffer(); OutputStream outCBC = new OutputStream(buf); outCBC._OB_writeEndian(); CodeBaseHelper.write(outCBC, codeBase); codeBaseSC_ = new ServiceContext(); codeBaseSC_.context_id = org.omg.IOP.SendingContextRunTime.value; int len = buf.length(); byte[] data = buf.data(); codeBaseSC_.context_data = new byte[len]; System.arraycopy(data, 0, codeBaseSC_.context_data, 0, len); } // // NOTE: We don't initialize the INVOCATION_POLICIES service context // here because the list of policies can change from one invocation to // the next. Instead, we need to get the policies and build the // service context each time we make an invocation. // } // ---------------------------------------------------------------------- // GIOPClient package member implementations // ---------------------------------------------------------------------- GIOPClient(ORBInstance orbInstance, Connector connector, int concModel, CodeConverters conv, boolean bidirEnable) { super(concModel, conv); orbInstance_ = orbInstance; connector_ = connector; connection_ = null; destroy_ = false; bidirWorker_ = bidirEnable; } // ---------------------------------------------------------------------- // GIOPClient public member implementations // ---------------------------------------------------------------------- /** Destroy the client */ public synchronized void destroy() { if (destroy_) return; destroy_ = true; connection_ = null; // release the reference if this is an outbound connection if (connectionRef != null) connectionRef.close(); } /** Get a new request ID */ public int getNewRequestID() { return connection_.getNewRequestId(); } // // get a list of ServiceContexts that have to be sent on an AMI router // request // public ServiceContext[] getAMIRouterSCL() { // // initialize the service contexts if they haven't already been // initServiceContexts(); ServiceContext[] scl = new ServiceContext[1]; scl[0] = codeSetSC_; // // return the list // return scl; } /** Get all profiles that are usable with this client */ public ProfileInfo[] getUsableProfiles(IOR ior, Policy[] policies) { // Get all profiles usable for the connector List<ProfileInfo> profileInfos = new ArrayList<>(); for (ProfileInfo anAll : connector_.get_usable_profiles(ior, policies)) { CodeConverters conv = CodeSetUtil.getCodeConverters(orbInstance_, anAll); // Filter out profiles which would require a different code converter if (codeConverters().equals(conv)) profileInfos.add(anAll); } return profileInfos.toArray(new ProfileInfo[profileInfos.size()]); } /** Get the OCI Connector info */ public org.apache.yoko.orb.OCI.ConnectorInfo connectorInfo() { return connector_.get_info(); } /** Get the OCI Transport info */ public org.apache.yoko.orb.OCI.TransportInfo transportInfo() { // // Get the connection, but do not create a new one if there is none // available // GIOPConnection connection = getWorker(false, -1); if (connection == null) return null; Transport transport = connection.transport(); return transport.get_info(); } // // Start a downcall, returning a downcall emitter and an // OutputStream for marshalling a request // public DowncallEmitter startDowncall(Downcall down, OutputStreamHolder out) { GIOPConnection connection; try { // // Get the worker, creating a new one if there is none // available // connection = getWorker(true, down.policies().connectTimeout); } catch (org.omg.CORBA.SystemException ex) { Assert ._OB_assert(ex.completed == CompletionStatus.COMPLETED_NO); down.setFailureException(ex); return null; } try { // // We only need to add a code set context if we're GIOP // version 1.1 or higher, and if no messages have been sent so // far // byte major = down.profileInfo().major; byte minor = down.profileInfo().minor; if (!connection.requestSent() && (major > 1 || minor >= 1)) { CoreTraceLevels coreTraceLevels = orbInstance_ .getCoreTraceLevels(); if (coreTraceLevels.traceConnections() >= 2) { CodeConverters conv = codeConverters(); String msg = "sending transmission code sets"; msg += "\nchar code set: "; if (conv.outputCharConverter != null) { msg += conv.outputCharConverter.getTo().description; } else { CodeSetInfo info = CodeSetDatabase.instance().getCodeSetInfo(orbInstance_.getNativeCs()); msg += info != null ? info.description : null; } msg += "\nwchar code set: "; if (conv.outputWcharConverter != null) msg += conv.outputWcharConverter.getTo().description; else { CodeSetInfo info = CodeSetDatabase.instance() .getCodeSetInfo(orbInstance_.getNativeWcs()); msg += info != null ? info.description : null; } orbInstance_.getLogger().trace("outgoing", msg); } Assert._OB_assert(codeSetSC_ != null); down.addToRequestSCL(codeSetSC_); Assert._OB_assert(codeBaseSC_ != null); down.addToRequestSCL(codeBaseSC_); } // // I don't want to send BiDir related contexts if I'm not // working with GIOP 1.2 or greater. // boolean validGIOPVersion = false; if ((major > 1) || ((major == 1) && (minor >= 2))) validGIOPVersion = true; if (validGIOPVersion && (down.policies().biDirMode == org.omg.BiDirPolicy.BOTH.value)) { Transport t = connection.transport(); ServiceContext contexts[] = t.get_info() .get_service_contexts(down.policies().value); for (ServiceContext context : contexts) down.addToRequestSCL(context); } ProfileInfo profileInfo = down .profileInfo(); Buffer buf = new Buffer( 12); buf.pos(12); out.value = new OutputStream(buf, codeConverters(), GiopVersion.get(profileInfo.major, profileInfo.minor)); // // Create GIOP outgoing message // GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage( orbInstance_, out.value, profileInfo); // // Write header // String op = down.operation(); if (op.charAt(0) == '_' && op.equals("_locate")) outgoing.writeLocateRequestHeader(down.requestId()); else outgoing.writeRequestHeader(down.requestId(), down.operation(), down.responseExpected(), down.getRequestSCL()); return connection.emitterInterface(); } catch (org.omg.CORBA.SystemException ex) { Assert ._OB_assert(ex.completed == CompletionStatus.COMPLETED_NO); down.setFailureException(ex); return null; } } /** Checks whether this client is equal to another client */ public boolean matches(Client other) { if (!!!(other instanceof GIOPClient)) return false; GIOPClient that = (GIOPClient) other; return this.connector_.equal(that.connector_) && this.codeConverters().equals(that.codeConverters()); } /** Force connection establishment */ public void bind(int connectTimeout) { // // Get the connection, creating a new one if there is none // available // getWorker(true, connectTimeout); } /** Determines whether this client supports twoway invocations */ public boolean twoway() { // // Get the connection // GIOPConnection connection = getWorker(false, -1); Assert._OB_assert(connection != null); Transport transport = connection.transport(); return transport.mode() == org.apache.yoko.orb.OCI.SendReceiveMode.SendReceive; } @Override public void prepareForDowncall(RefCountPolicyList policies) { getWorker(true, policies.connectTimeout); } }
6,287
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocationTransparencyPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.LOCATION_TRANSPARENCY_POLICY_ID; import org.apache.yoko.orb.OB.LocationTransparencyPolicy; final public class LocationTransparencyPolicy_impl extends org.omg.CORBA.LocalObject implements LocationTransparencyPolicy { private short value_; // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public short value() { return value_; } public int policy_type() { return LOCATION_TRANSPARENCY_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ public LocationTransparencyPolicy_impl(short value) { value_ = value; } }
6,288
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/URLRegistry.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/URLRegistry:1.0 // /** * * The URLRegistry holds all of the supported URL schemes. * * @see URLScheme * **/ public interface URLRegistry extends URLRegistryOperations, org.omg.CORBA.Object { }
6,289
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ZeroPortPolicyHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/ZeroPortPolicy:1.0 // final public class ZeroPortPolicyHolder implements org.omg.CORBA.portable.Streamable { public ZeroPortPolicy value; public ZeroPortPolicyHolder() { } public ZeroPortPolicyHolder(ZeroPortPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = ZeroPortPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { ZeroPortPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return ZeroPortPolicyHelper.type(); } }
6,290
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootManagerHolder.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/BootManager:1.0 // final public class BootManagerHolder implements org.omg.CORBA.portable.Streamable { public BootManager value; public BootManagerHolder() { } public BootManagerHolder(BootManager initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = BootManagerHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { BootManagerHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return BootManagerHelper.type(); } }
6,291
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeSetIORInterceptor_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final public class CodeSetIORInterceptor_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableInterceptor.IORInterceptor_3_0 { // // The native codesets // private int nativeCs_; private int nativeWcs_; public CodeSetIORInterceptor_impl(int nativeCs, int nativeWcs) { nativeCs_ = nativeCs; nativeWcs_ = nativeWcs; } // // IDL to Java Mapping // public String name() { return ""; } public void destroy() { } public void establish_components(org.omg.PortableInterceptor.IORInfo info) { org.omg.CONV_FRAME.CodeSetComponent c = CodeSetUtil .createCodeSetComponent(nativeCs_, false); org.omg.CONV_FRAME.CodeSetComponent wc = CodeSetUtil .createCodeSetComponent(nativeWcs_, true); org.omg.CONV_FRAME.CodeSetComponentInfo codeSetInfo = new org.omg.CONV_FRAME.CodeSetComponentInfo( c, wc); org.omg.IOP.TaggedComponent component = new org.omg.IOP.TaggedComponent(); component.tag = org.omg.IOP.TAG_CODE_SETS.value; // // The Codec could be used here -- but that means that the // Any insertion/extraction operators would have to be // generated unnecessarily // org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(); org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream( buf); out._OB_writeEndian(); org.omg.CONV_FRAME.CodeSetComponentInfoHelper.write(out, codeSetInfo); component.component_data = new byte[out._OB_pos()]; System.arraycopy(buf.data(), 0, component.component_data, 0, buf .length()); try { info.add_ior_component(component); } catch (org.omg.CORBA.BAD_PARAM ex) { // Ignore - profile may not be supported } } public void components_established(org.omg.PortableInterceptor.IORInfo info) { } public void adapter_manager_state_changed(String id, short state) { } public void adapter_state_changed( org.omg.PortableInterceptor.ObjectReferenceTemplate[] templates, short state) { } }
6,292
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RetryPolicy.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/RetryPolicy:1.0 // /** * * The retry policy. This policy is used to specify retry behavior after * communication failures (i.e., <code>CORBA::TRANSIENT</code> and * <code>CORBA::COMM_FAILURE</code> exceptions). * **/ public interface RetryPolicy extends RetryPolicyOperations, org.omg.CORBA.Policy { }
6,293
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/OrbAsyncHandler.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.OB.TimeHelper; public class OrbAsyncHandler { // // A message registered to be sent/received asynchronously // class AsyncMessage { // // the target object // public org.omg.CORBA.Object object; // // The poller used to retrieve the event response // public org.apache.yoko.orb.OBMessaging.Poller_impl poller; // // The downcall sent/received // public Downcall downcall; // // Servant onto which to invoke a response when received // (poller || reply) == 0 // public org.omg.Messaging.ReplyHandler reply; } // // Worker thread class // class OAH_Worker extends Thread { // // parent handler // protected OrbAsyncHandler handler_ = null; // // has this worker been shutdown // protected boolean shutdown_ = false; // // Constructor // OAH_Worker() { super("Yoko:Client:OrbAsyncHandler:OAH_Worker"); } // // set the parent handler // public void handler(OrbAsyncHandler parent) { Assert._OB_assert(parent != null); handler_ = parent; } // // get the parent handler // public OrbAsyncHandler handler() { return handler_; } // // thread run process // public void run() { while (true) { AsyncMessage msg = null; synchronized (handler_.sendMonitor_) { // // check for a shutdown first // synchronized (this) { if (shutdown_ == true) break; } // // if there are no messages to send then we want to // wait until there is // try { if (handler_.uncompletedMsgList_.size() == 0) { handler_.sendMonitor_.wait(); } } catch (InterruptedException ex) { // // this is not really an issue // } // // check again if there is a message because the // wait could have been stopped by an interruption // or a shutdown call // if (handler_.uncompletedMsgList_.size() > 0) { msg = (AsyncMessage) handler_.uncompletedMsgList_ .removeFirst(); } } // // send/receive the request if there is one // if (msg != null) { // // Check to see if this is a new, unsent message or if // this is a message that was delayed by a replyStart/ // replyEnd time policy // if (msg.downcall.unsent()) { // // if we have a RequestStartTime policy set, put the // message back into the uncompletedMsgList // org.omg.TimeBase.UtcT requestStartTime = msg.downcall .policies().requestStartTime; if (TimeHelper.notEqual(requestStartTime, TimeHelper .utcMin()) && TimeHelper.greaterThan(requestStartTime, TimeHelper.utcNow(0))) { synchronized (handler_.sendMonitor_) { handler_.uncompletedMsgList_.addLast(msg); handler_.sendMonitor_.notifyAll(); } continue; } // // if we have a RequestEndTime policy set, then we // should discard the message since it is no longer // valid // org.omg.TimeBase.UtcT requestEndTime = msg.downcall .policies().requestEndTime; if (TimeHelper.notEqual(requestEndTime, TimeHelper .utcMin()) && TimeHelper.lessThan(requestEndTime, TimeHelper.utcNow(0))) { continue; } try { msg.downcall.request(); } catch (org.apache.yoko.orb.OB.LocationForward ex) { // // TODO: A REBIND can also be thrown if the policy // has a value of NO_REBIND and returned IORs // policy requirements are incompatible with // effective policies currently in use. // if (msg.downcall.policies().rebindMode == org.omg.Messaging.NO_RECONNECT.value) { msg.downcall .setSystemException(new org.omg.CORBA.REBIND()); } } catch (org.apache.yoko.orb.OB.FailureException ex) { // // handle failure exception // continue; } } // // check for a ReplyStartTime policy. If it has not // come into effect yet, add this message to the // delayedMsgList // org.omg.TimeBase.UtcT replyStartTime = msg.downcall .policies().replyStartTime; if (TimeHelper .notEqual(replyStartTime, TimeHelper.utcMin()) && TimeHelper.greaterThan(replyStartTime, TimeHelper.utcNow(0))) { synchronized (handler_.sendMonitor_) { handler_.uncompletedMsgList_.addLast(msg); handler_.sendMonitor_.notifyAll(); } continue; } // // check to see if the ReplyEndTime policy prevents us // from delivering the reply // org.omg.TimeBase.UtcT replyEndTime = msg.downcall .policies().replyEndTime; if (TimeHelper.notEqual(replyEndTime, TimeHelper.utcMin()) && TimeHelper.lessThan(replyEndTime, TimeHelper .utcNow(0))) { continue; } // // if there is a reply handler to invoke, do it now // if (msg.reply != null) { org.apache.yoko.orb.OBMessaging.ReplyHandler_impl reply = (org.apache.yoko.orb.OBMessaging.ReplyHandler_impl) msg.reply; reply._OB_invoke(msg.downcall); continue; } // // so there was no reply handler which means there // MUST be a poller // Assert._OB_assert(msg.poller != null); // // check the poller for its reply handler // org.omg.Messaging.ReplyHandler msgReply = msg.poller .associated_handler(); if (msgReply != null) { org.apache.yoko.orb.OBMessaging.ReplyHandler_impl reply = (org.apache.yoko.orb.OBMessaging.ReplyHandler_impl) msgReply; reply._OB_invoke(msg.downcall); continue; } // // there was no reply handler to handle the message // so we can put it into the completed list now and // notify any clients waiting on this list // synchronized (handler_.recvMonitor_) { handler_.completedMsgList_.addLast(msg); handler_.recvMonitor_.notifyAll(); } } } } // // called to stop this worker thread // public synchronized void shutdown() { shutdown_ = true; } } // // possible states for the handler // final class State { public static final int OAH_STATE_DORMANT = 0; public static final int OAH_STATE_ACTIVE = 1; public static final int OAH_STATE_SHUTDOWN = 2; } // // the group of unsent messages // protected java.util.LinkedList uncompletedMsgList_ = null; // // the group of completed messages // protected java.util.LinkedList completedMsgList_ = null; // // the send monitor // protected java.lang.Object sendMonitor_ = null; // // the receive monitor // protected java.lang.Object recvMonitor_ = null; // // The worker threads // protected OAH_Worker[] worker_ = null; // // the number of worker threads // protected int numWorkers_; // // the current state of the handler // protected int state_ = State.OAH_STATE_DORMANT; // // constructor // OrbAsyncHandler(int worker_threads) { numWorkers_ = worker_threads; if (numWorkers_ <= 0) numWorkers_ = 1; } // // activate the handler // public synchronized void activate() { // // make sure we're not in the shutdown state // Assert._OB_assert(state_ != State.OAH_STATE_SHUTDOWN); // // no need to activate more than once... // if (state_ == State.OAH_STATE_ACTIVE) return; // // now put this handler into the activated state // state_ = State.OAH_STATE_ACTIVE; // // create the necessary message lists and monitors // uncompletedMsgList_ = new java.util.LinkedList(); completedMsgList_ = new java.util.LinkedList(); sendMonitor_ = new java.lang.Object(); recvMonitor_ = new java.lang.Object(); // // create the worker thread now // worker_ = new OAH_Worker[numWorkers_]; for (int i = 0; i < numWorkers_; i++) { worker_[i] = new OAH_Worker(); worker_[i].handler(this); worker_[i].start(); } } // // shutdown the handler // public synchronized void shutdown() { // // no need to shutdown more than once // if (state_ == State.OAH_STATE_SHUTDOWN) return; // // if we're in the DORMANT state, then we haven't been // initialized yet so there is no need to perform a cleanup // if (state_ == State.OAH_STATE_DORMANT) { state_ = State.OAH_STATE_SHUTDOWN; return; } // // go into the shutdown state // state_ = State.OAH_STATE_SHUTDOWN; // // stop the worker from processing // for (int i = 0; i < numWorkers_; i++) worker_[i].shutdown(); // // wake up the worker if its sleepingon the send monitor // synchronized (sendMonitor_) { sendMonitor_.notifyAll(); } // // join the worker thread to be assured of its completion // for (int i = 0; i < numWorkers_; i++) { while (true) { try { worker_[i].join(); break; } catch (InterruptedException ex) { continue; } } } // // clear the contents of the message lists // uncompletedMsgList_.clear(); completedMsgList_.clear(); } // // add a polled request to the queued list // public void addMessage(Downcall down, org.apache.yoko.orb.OBMessaging.Poller_impl poller) { Assert._OB_assert(down != null); Assert._OB_assert(poller != null); // // activate the handler if it isn't already // activate(); // // create a new unsent message // AsyncMessage msg = new AsyncMessage(); msg.object = null; msg.poller = poller; msg.downcall = down; msg.reply = null; // // add it to the internal unsent list and notify the worker // thread that there is a message that needs sending // synchronized (sendMonitor_) { uncompletedMsgList_.addLast(msg); sendMonitor_.notify(); } } // // add a reply handled request to the queued list // public void addMessage(Downcall down, org.omg.Messaging.ReplyHandler reply) { Assert._OB_assert(down != null); Assert._OB_assert(reply != null); // // activate this handler if it isn't already // activate(); // // create a new async message // AsyncMessage msg = new AsyncMessage(); msg.object = null; msg.poller = null; msg.downcall = down; msg.reply = reply; // // add it to the internal unsent list and notify the worker // thread that there is a message that needs sending // synchronized (sendMonitor_) { uncompletedMsgList_.addLast(msg); sendMonitor_.notify(); } } // // poll if a message has completed // public boolean is_ready(org.apache.yoko.orb.OBMessaging.Poller_impl poller, int timeout) { Assert._OB_assert(poller != null); boolean waitInfinite = false; if (timeout == -1) waitInfinite = true; while (true) { // // get the start time // long start_time = System.currentTimeMillis(); // // check the list to see if any messages match our poller // synchronized (recvMonitor_) { java.util.ListIterator i = completedMsgList_.listIterator(0); while (i.hasNext()) { AsyncMessage msg = (AsyncMessage) i.next(); if (msg.poller == poller) { // // check for the ReplyEndTime policy. If it is in // effect, we can no longer deliver the reply. // Otherwise, indicate to the client that the reply // is ready. // org.omg.TimeBase.UtcT replyEndTime = msg.downcall .policies().replyEndTime; if (TimeHelper.notEqual(replyEndTime, TimeHelper .utcMin()) && TimeHelper.lessThan(replyEndTime, TimeHelper .utcNow(0))) { return false; } return true; } } } // // if the timeout is 0 then we need to return immediately // if (timeout == 0) return false; // // otherwise, wait the specified time on the receive queue to // see if a message arrives that matches our poller // try { synchronized (recvMonitor_) { if (waitInfinite == true) recvMonitor_.wait(); else recvMonitor_.wait(timeout); } } catch (InterruptedException ex) { // // an interruption isn't so bad... we can simply recheck // again for a completed, matching message and if its not // there, then resume sleeping // } // // recalculate the time to wait next time around // if (waitInfinite == false) { // // get the ending time // long end_time = System.currentTimeMillis(); // // calculate the difference in milliseconds and subtract // from timeout // long diff_time = end_time - start_time; if (diff_time > timeout) timeout = 0; else timeout -= diff_time; } } } // // perform a wait until any response comes in // Used by PollableSets to block on responses // public void waitOnResponse(int timeout) { try { synchronized (recvMonitor_) { if (timeout == -1) recvMonitor_.wait(); else recvMonitor_.wait(timeout); } } catch (InterruptedException ex) { // // Only the PollableSet uses this method and if this method // returns it will check for an appropriate message... if it // doesn't exist, then it will resume waiting again. // Therefore we don't need to perform a continuation here // just to fulfill the time // } } // // get a response // public Downcall poll_response( org.apache.yoko.orb.OBMessaging.Poller_impl poller) { Assert._OB_assert(poller != null); synchronized (recvMonitor_) { // // search the list for a matching message // java.util.ListIterator iter = completedMsgList_.listIterator(0); while (iter.hasNext()) { AsyncMessage msg = (AsyncMessage) iter.next(); if (msg.poller == poller) { // // remove this item from the list // iter.remove(); // // return the downcall // return msg.downcall; } } } // // is_ready should have been called first to verify that a // response was ready so it is an error to not have one // Assert._OB_assert(false); return null; } }
6,294
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategy.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/DispatchStrategy:1.0 // /** * * This interface represents a dispatch strategy. To dispatch a * request the ORB will pass a DispatchRequest. The dispatch strategy * should call DispatchRequest::invoke() in the correct thread * context. * * @see DispatchRequest * @see DispatchStrategyFactory * **/ public interface DispatchStrategy extends DispatchStrategyOperations, org.omg.CORBA.Object { }
6,295
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/SAME_THREAD.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; // // IDL:orb.yoko.apache.org/OB/SAME_THREAD:1.0 // /** The <code>SAME_THREAD</code> DispatchStrategyId. */ public interface SAME_THREAD { int value = (int)(0L); }
6,296
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeSetDatabaseInit.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final class CodeSetDatabaseInit { static int codeSetInfoArraySize_ = 192; static short[] codeSetCharValues0 = { 0x0011 }; static short[] codeSetCharValues1 = { 0x0012 }; static short[] codeSetCharValues2 = { 0x0013 }; static short[] codeSetCharValues3 = { 0x0014 }; static short[] codeSetCharValues4 = { 0x0015 }; static short[] codeSetCharValues5 = { 0x0016 }; static short[] codeSetCharValues6 = { 0x0017 }; static short[] codeSetCharValues7 = { 0x0018 }; static short[] codeSetCharValues8 = { 0x0019 }; static short[] codeSetCharValues9 = { 0x001a }; static short[] codeSetCharValues10 = { 0x0011 }; static short[] codeSetCharValues11 = { 0x0001 }; static short[] codeSetCharValues12 = { 0x1000 }; static short[] codeSetCharValues13 = { 0x1000 }; static short[] codeSetCharValues14 = { 0x1000 }; static short[] codeSetCharValues15 = { 0x1000 }; static short[] codeSetCharValues16 = { 0x1000 }; static short[] codeSetCharValues17 = { 0x1000 }; static short[] codeSetCharValues18 = { 0x1000 }; static short[] codeSetCharValues19 = { 0x1000 }; static short[] codeSetCharValues20 = { 0x0080 }; static short[] codeSetCharValues21 = { 0x0081 }; static short[] codeSetCharValues22 = { 0x0081 }; static short[] codeSetCharValues23 = { 0x0081 }; static short[] codeSetCharValues24 = { 0x0082 }; static short[] codeSetCharValues25 = { 0x0011, 0x0080, 0x0081, 0x0082 }; static short[] codeSetCharValues26 = { 0x0100 }; static short[] codeSetCharValues27 = { 0x0101 }; static short[] codeSetCharValues28 = { 0x0011, 0x0100, 0x0101 }; static short[] codeSetCharValues29 = { 0x0180 }; static short[] codeSetCharValues30 = { 0x0181 }; static short[] codeSetCharValues31 = { 0x0001, 0x0180 }; static short[] codeSetCharValues32 = { 0x0001, 0x0181 }; static short[] codeSetCharValues33 = { 0x0200 }; static short[] codeSetCharValues34 = { 0x0180 }; static short[] codeSetCharValues35 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues36 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues37 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues38 = { 0x1000 }; static short[] codeSetCharValues39 = { 0x0001, 0x0080, 0x0081, 0x0082 }; static short[] codeSetCharValues40 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues41 = { 0x0011, 0x0080, 0x0081 }; static short[] codeSetCharValues42 = { 0x0011, 0x0080, 0x0081, 0x0082 }; static short[] codeSetCharValues43 = { 0x0011, 0x0080, 0x0081 }; static short[] codeSetCharValues44 = { 0x0011 }; static short[] codeSetCharValues45 = { 0x0080 }; static short[] codeSetCharValues46 = { 0x0016 }; static short[] codeSetCharValues47 = { 0x0017 }; static short[] codeSetCharValues48 = { 0x0018 }; static short[] codeSetCharValues49 = { 0x0013, 0x0019 }; static short[] codeSetCharValues50 = { 0x0001, 0x0300 }; static short[] codeSetCharValues51 = { 0x0001, 0x0180 }; static short[] codeSetCharValues52 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues53 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues54 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues55 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues56 = { 0x0011 }; static short[] codeSetCharValues57 = { 0x0011 }; static short[] codeSetCharValues58 = { 0x0011 }; static short[] codeSetCharValues59 = { 0x0011 }; static short[] codeSetCharValues60 = { 0x0011 }; static short[] codeSetCharValues61 = { 0x0011 }; static short[] codeSetCharValues62 = { 0x0011 }; static short[] codeSetCharValues63 = { 0x0011 }; static short[] codeSetCharValues64 = { 0x0080 }; static short[] codeSetCharValues65 = { 0x0011 }; static short[] codeSetCharValues66 = { 0x0081 }; static short[] codeSetCharValues67 = { 0x0081 }; static short[] codeSetCharValues68 = { 0x0016 }; static short[] codeSetCharValues69 = { 0x0018 }; static short[] codeSetCharValues70 = { 0x0011 }; static short[] codeSetCharValues71 = { 0x0011 }; static short[] codeSetCharValues72 = { 0x0001 }; static short[] codeSetCharValues73 = { 0x0100 }; static short[] codeSetCharValues74 = { 0x0180 }; static short[] codeSetCharValues75 = { 0x0001 }; static short[] codeSetCharValues76 = { 0x0300 }; static short[] codeSetCharValues77 = { 0x0200 }; static short[] codeSetCharValues78 = { 0x0200 }; static short[] codeSetCharValues79 = { 0x0011 }; static short[] codeSetCharValues80 = { 0x0012 }; static short[] codeSetCharValues81 = { 0x0015 }; static short[] codeSetCharValues82 = { 0x0018 }; static short[] codeSetCharValues83 = { 0x0019 }; static short[] codeSetCharValues84 = { 0x0011 }; static short[] codeSetCharValues85 = { 0x0018 }; static short[] codeSetCharValues86 = { 0x0011 }; static short[] codeSetCharValues87 = { 0x0016 }; static short[] codeSetCharValues88 = { 0x0015 }; static short[] codeSetCharValues89 = { 0x0016 }; static short[] codeSetCharValues90 = { 0x0017 }; static short[] codeSetCharValues91 = { 0x0012 }; static short[] codeSetCharValues92 = { 0x0011 }; static short[] codeSetCharValues93 = { 0x0200 }; static short[] codeSetCharValues94 = { 0x0017 }; static short[] codeSetCharValues95 = { 0x0015 }; static short[] codeSetCharValues96 = { 0x0001 }; static short[] codeSetCharValues97 = { 0x0080 }; static short[] codeSetCharValues98 = { 0x0080 }; static short[] codeSetCharValues99 = { 0x0001 }; static short[] codeSetCharValues100 = { 0x0001 }; static short[] codeSetCharValues101 = { 0x0016 }; static short[] codeSetCharValues102 = { 0x001a }; static short[] codeSetCharValues103 = { 0x001a }; static short[] codeSetCharValues104 = { 0x0100 }; static short[] codeSetCharValues105 = { 0x0180 }; static short[] codeSetCharValues106 = { 0x0300 }; static short[] codeSetCharValues107 = { 0x0200 }; static short[] codeSetCharValues108 = { 0x0080, 0x0081 }; static short[] codeSetCharValues109 = { 0x0080, 0x0081 }; static short[] codeSetCharValues110 = { 0x0001, 0x0100 }; static short[] codeSetCharValues111 = { 0x0001, 0x0100 }; static short[] codeSetCharValues112 = { 0x0001, 0x0300 }; static short[] codeSetCharValues113 = { 0x0001, 0x0300 }; static short[] codeSetCharValues114 = { 0x0001, 0x0180 }; static short[] codeSetCharValues115 = { 0x0001, 0x0180 }; static short[] codeSetCharValues116 = { 0x0080, 0x0081 }; static short[] codeSetCharValues117 = { 0x0081 }; static short[] codeSetCharValues118 = { 0x0080, 0x0081 }; static short[] codeSetCharValues119 = { 0x0080, 0x0081 }; static short[] codeSetCharValues120 = { 0x0001, 0x0300 }; static short[] codeSetCharValues121 = { 0x0180 }; static short[] codeSetCharValues122 = { 0x0001, 0x0180 }; static short[] codeSetCharValues123 = { 0x0001, 0x0100 }; static short[] codeSetCharValues124 = { 0x0001, 0x0180 }; static short[] codeSetCharValues125 = { 0x0100 }; static short[] codeSetCharValues126 = { 0x0081 }; static short[] codeSetCharValues127 = { 0x0001, 0x0180 }; static short[] codeSetCharValues128 = { 0x0011, 0x0100, 0x0101 }; static short[] codeSetCharValues129 = { 0x0016 }; static short[] codeSetCharValues130 = { 0x0015 }; static short[] codeSetCharValues131 = { 0x0019 }; static short[] codeSetCharValues132 = { 0x0080 }; static short[] codeSetCharValues133 = { 0x0001 }; static short[] codeSetCharValues134 = { 0x0080 }; static short[] codeSetCharValues135 = { 0x0001 }; static short[] codeSetCharValues136 = { 0x0016 }; static short[] codeSetCharValues137 = { 0x0011 }; static short[] codeSetCharValues138 = { 0x0001 }; static short[] codeSetCharValues139 = { 0x0016 }; static short[] codeSetCharValues140 = { 0x0016 }; static short[] codeSetCharValues141 = { 0x001a }; static short[] codeSetCharValues142 = { 0x0001 }; static short[] codeSetCharValues143 = { 0x0001 }; static short[] codeSetCharValues144 = { 0x001a }; static short[] codeSetCharValues145 = { 0x0012 }; static short[] codeSetCharValues146 = { 0x0015 }; static short[] codeSetCharValues147 = { 0x0011 }; static short[] codeSetCharValues148 = { 0x0017 }; static short[] codeSetCharValues149 = { 0x0019 }; static short[] codeSetCharValues150 = { 0x0018 }; static short[] codeSetCharValues151 = { 0x0016 }; static short[] codeSetCharValues152 = { 0x001a }; static short[] codeSetCharValues153 = { 0x0300 }; static short[] codeSetCharValues154 = { 0x0001, 0x0300 }; static short[] codeSetCharValues155 = { 0x0001, 0x0300 }; static short[] codeSetCharValues156 = { 0x0081 }; static short[] codeSetCharValues157 = { 0x0011 }; static short[] codeSetCharValues158 = { 0x0012 }; static short[] codeSetCharValues159 = { 0x0015 }; static short[] codeSetCharValues160 = { 0x0018 }; static short[] codeSetCharValues161 = { 0x0019 }; static short[] codeSetCharValues162 = { 0x0016 }; static short[] codeSetCharValues163 = { 0x0016 }; static short[] codeSetCharValues164 = { 0x0017 }; static short[] codeSetCharValues165 = { 0x0080, 0x0081 }; static short[] codeSetCharValues166 = { 0x0001, 0x0300 }; static short[] codeSetCharValues167 = { 0x0080, 0x0081 }; static short[] codeSetCharValues168 = { 0x0081 }; static short[] codeSetCharValues169 = { 0x0082 }; static short[] codeSetCharValues170 = { 0x0100 }; static short[] codeSetCharValues171 = { 0x0016 }; static short[] codeSetCharValues172 = { 0x0001 }; static short[] codeSetCharValues173 = { 0x0100 }; static short[] codeSetCharValues174 = { 0x0200 }; static short[] codeSetCharValues175 = { 0x0016 }; static short[] codeSetCharValues176 = { 0x0200 }; static short[] codeSetCharValues177 = { 0x0001, 0x0100 }; static short[] codeSetCharValues178 = { 0x0011 }; static short[] codeSetCharValues179 = { 0x0018 }; static short[] codeSetCharValues180 = { 0x0001 }; static short[] codeSetCharValues181 = { 0x0001 }; static short[] codeSetCharValues182 = { 0x0018 }; static short[] codeSetCharValues183 = { 0x0080, 0x0081, 0x0082 }; static short[] codeSetCharValues184 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues185 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues186 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues187 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues188 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues189 = { 0x0001, 0x0081 }; static short[] codeSetCharValues190 = { 0x0001, 0x0080, 0x0081 }; static short[] codeSetCharValues191 = { 0x0001, 0x0081 }; static CodeSetInfo[] codeSetInfoArray_ = new CodeSetInfo[192]; static { codeSetInfoArray_[0] = new CodeSetInfo( "ISO 8859-1:1987; Latin Alphabet No. 1", 0x00010001, 1, codeSetCharValues0, (short) 1); codeSetInfoArray_[1] = new CodeSetInfo( "ISO 8859-2:1987; Latin Alphabet No. 2", 0x00010002, 1, codeSetCharValues1, (short) 1); codeSetInfoArray_[2] = new CodeSetInfo( "ISO 8859-3:1988; Latin Alphabet No. 3", 0x00010003, 1, codeSetCharValues2, (short) 1); codeSetInfoArray_[3] = new CodeSetInfo( "ISO 8859-4:1988; Latin Alphabet No. 4", 0x00010004, 1, codeSetCharValues3, (short) 1); codeSetInfoArray_[4] = new CodeSetInfo( "ISO/IEC 8859-5:1988; Latin-Cyrillic Alphabet", 0x00010005, 1, codeSetCharValues4, (short) 1); codeSetInfoArray_[5] = new CodeSetInfo( "ISO 8859-6:1987; Latin-Arabic Alphabet", 0x00010006, 1, codeSetCharValues5, (short) 1); codeSetInfoArray_[6] = new CodeSetInfo( "ISO 8859-7:1987; Latin-Greek Alphabet", 0x00010007, 1, codeSetCharValues6, (short) 1); codeSetInfoArray_[7] = new CodeSetInfo( "ISO 8859-8:1988; Latin-Hebrew Alphabet", 0x00010008, 1, codeSetCharValues7, (short) 1); codeSetInfoArray_[8] = new CodeSetInfo( "ISO/IEC 8859-9:1989; Latin Alphabet No. 5", 0x00010009, 1, codeSetCharValues8, (short) 1); codeSetInfoArray_[9] = new CodeSetInfo( "ISO/IEC 8859-10:1992; Latin Alphabet No. 6", 0x0001000a, 1, codeSetCharValues9, (short) 1); codeSetInfoArray_[10] = new CodeSetInfo( "ISO/IEC 8859-15:1999; Latin Alphabet No. 9", 0x0001000f, 1, codeSetCharValues10, (short) 1); codeSetInfoArray_[11] = new CodeSetInfo( "ISO 646:1991 IRV (International Reference Version)", 0x00010020, 1, codeSetCharValues11, (short) 1); codeSetInfoArray_[12] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UCS-2, Level 1", 0x00010100, 1, codeSetCharValues12, (short) 2); codeSetInfoArray_[13] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UCS-2, Level 2", 0x00010101, 1, codeSetCharValues13, (short) 2); codeSetInfoArray_[14] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UCS-2, Level 3", 0x00010102, 1, codeSetCharValues14, (short) 2); codeSetInfoArray_[15] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UCS-4, Level 1", 0x00010104, 1, codeSetCharValues15, (short) 4); codeSetInfoArray_[16] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UCS-4, Level 2", 0x00010105, 1, codeSetCharValues16, (short) 4); codeSetInfoArray_[17] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UCS-4, Level 3", 0x00010106, 1, codeSetCharValues17, (short) 4); codeSetInfoArray_[18] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UTF-1, UCS Transformation Format 1", 0x00010108, 1, codeSetCharValues18, (short) 5); codeSetInfoArray_[19] = new CodeSetInfo( "ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form", 0x00010109, 1, codeSetCharValues19, (short) 2); codeSetInfoArray_[20] = new CodeSetInfo( "JIS X0201:1976; Japanese phonetic characters", 0x00030001, 1, codeSetCharValues20, (short) 1); codeSetInfoArray_[21] = new CodeSetInfo( "JIS X0208:1978 Japanese Kanji Graphic Characters", 0x00030004, 1, codeSetCharValues21, (short) 2); codeSetInfoArray_[22] = new CodeSetInfo( "JIS X0208:1983 Japanese Kanji Graphic Characters", 0x00030005, 1, codeSetCharValues22, (short) 2); codeSetInfoArray_[23] = new CodeSetInfo( "JIS X0208:1990 Japanese Kanji Graphic Characters", 0x00030006, 1, codeSetCharValues23, (short) 2); codeSetInfoArray_[24] = new CodeSetInfo( "JIS X0212:1990; Supplementary Japanese Kanji Graphic Chars", 0x0003000a, 1, codeSetCharValues24, (short) 2); codeSetInfoArray_[25] = new CodeSetInfo("JIS eucJP:1993; Japanese EUC", 0x00030010, 4, codeSetCharValues25, (short) 3); codeSetInfoArray_[26] = new CodeSetInfo( "KS C5601:1987; Korean Hangul and Hanja Graphic Characters", 0x00040001, 1, codeSetCharValues26, (short) 2); codeSetInfoArray_[27] = new CodeSetInfo( "KS C5657:1991; Supplementary Korean Graphic Characters", 0x00040002, 1, codeSetCharValues27, (short) 2); codeSetInfoArray_[28] = new CodeSetInfo("KS eucKR:1991; Korean EUC", 0x0004000a, 3, codeSetCharValues28, (short) 2); codeSetInfoArray_[29] = new CodeSetInfo( "CNS 11643:1986; Taiwanese Hanzi Graphic Characters", 0x00050001, 1, codeSetCharValues29, (short) 2); codeSetInfoArray_[30] = new CodeSetInfo( "CNS 11643:1992; Taiwanese Extended Hanzi Graphic Chars", 0x00050002, 1, codeSetCharValues30, (short) 4); codeSetInfoArray_[31] = new CodeSetInfo( "CNS eucTW:1991; Taiwanese EUC", 0x0005000a, 2, codeSetCharValues31, (short) 4); codeSetInfoArray_[32] = new CodeSetInfo( "CNS eucTW:1993; Taiwanese EUC", 0x00050010, 2, codeSetCharValues32, (short) 4); codeSetInfoArray_[33] = new CodeSetInfo( "TIS 620-2529, Thai characters", 0x000b0001, 1, codeSetCharValues33, (short) 1); codeSetInfoArray_[34] = new CodeSetInfo( "TTB CCDC:1984; Chinese Code for Data Communications", 0x000d0001, 1, codeSetCharValues34, (short) 2); codeSetInfoArray_[35] = new CodeSetInfo("OSF Japanese UJIS", 0x05000010, 3, codeSetCharValues35, (short) 2); codeSetInfoArray_[36] = new CodeSetInfo("OSF Japanese SJIS-1", 0x05000011, 3, codeSetCharValues36, (short) 2); codeSetInfoArray_[37] = new CodeSetInfo("OSF Japanese SJIS-2", 0x05000012, 3, codeSetCharValues37, (short) 2); codeSetInfoArray_[38] = new CodeSetInfo( "X/Open UTF-8; UCS Transformation Format 8 (UTF-8)", 0x05010001, 1, codeSetCharValues38, (short) 6); codeSetInfoArray_[39] = new CodeSetInfo("JVC_eucJP", 0x05020001, 4, codeSetCharValues39, (short) 3); codeSetInfoArray_[40] = new CodeSetInfo("JVC_SJIS", 0x05020002, 3, codeSetCharValues40, (short) 2); codeSetInfoArray_[41] = new CodeSetInfo("DEC Kanji", 0x10000001, 3, codeSetCharValues41, (short) 2); codeSetInfoArray_[42] = new CodeSetInfo("Super DEC Kanji", 0x10000002, 4, codeSetCharValues42, (short) 3); codeSetInfoArray_[43] = new CodeSetInfo("DEC Shift JIS", 0x10000003, 3, codeSetCharValues43, (short) 2); codeSetInfoArray_[44] = new CodeSetInfo( "HP roman8; English and Western European languages", 0x10010001, 1, codeSetCharValues44, (short) 1); codeSetInfoArray_[45] = new CodeSetInfo( "HP kana8; Japanese katakana (incl JIS X0201:1976)", 0x10010002, 1, codeSetCharValues45, (short) 1); codeSetInfoArray_[46] = new CodeSetInfo("HP arabic8; Arabic", 0x10010003, 1, codeSetCharValues46, (short) 1); codeSetInfoArray_[47] = new CodeSetInfo("HP greek8; Greek", 0x10010004, 1, codeSetCharValues47, (short) 1); codeSetInfoArray_[48] = new CodeSetInfo("HP hebrew8; Hebrew", 0x10010005, 1, codeSetCharValues48, (short) 1); codeSetInfoArray_[49] = new CodeSetInfo("HP turkish8; Turkish", 0x10010006, 2, codeSetCharValues49, (short) 1); codeSetInfoArray_[50] = new CodeSetInfo( "HP15CN; encoding method for Simplified Chinese", 0x10010007, 2, codeSetCharValues50, (short) 2); codeSetInfoArray_[51] = new CodeSetInfo( "HP big5; encoding method for Traditional Chinese", 0x10010008, 2, codeSetCharValues51, (short) 2); codeSetInfoArray_[52] = new CodeSetInfo( "HP japanese15 (sjis); Shift-JIS for mainframe (incl JIS X0208:1990)", 0x10010009, 3, codeSetCharValues52, (short) 2); codeSetInfoArray_[53] = new CodeSetInfo( "HP sjishi; Shift-JIS for HP user (incl JIS X0208:1990)", 0x1001000a, 3, codeSetCharValues53, (short) 2); codeSetInfoArray_[54] = new CodeSetInfo( "HP sjispc; Shift-JIS for PC (incl JIS X0208:1990)", 0x1001000b, 3, codeSetCharValues54, (short) 2); codeSetInfoArray_[55] = new CodeSetInfo( "HP ujis; EUC (incl JIS X0208:1990)", 0x1001000c, 3, codeSetCharValues55, (short) 2); codeSetInfoArray_[56] = new CodeSetInfo( "IBM-037 (CCSID 00037); CECP for USA, Canada, NL, Ptgl, Brazil, Australia, NZ", 0x10020025, 1, codeSetCharValues56, (short) 1); codeSetInfoArray_[57] = new CodeSetInfo( "IBM-273 (CCSID 00273); CECP for Austria, Germany", 0x10020111, 1, codeSetCharValues57, (short) 1); codeSetInfoArray_[58] = new CodeSetInfo( "IBM-277 (CCSID 00277); CECP for Denmark, Norway", 0x10020115, 1, codeSetCharValues58, (short) 1); codeSetInfoArray_[59] = new CodeSetInfo( "IBM-278 (CCSID 00278); CECP for Finland, Sweden", 0x10020116, 1, codeSetCharValues59, (short) 1); codeSetInfoArray_[60] = new CodeSetInfo( "IBM-280 (CCSID 00280); CECP for Italy", 0x10020118, 1, codeSetCharValues60, (short) 1); codeSetInfoArray_[61] = new CodeSetInfo( "IBM-282 (CCSID 00282); CECP for Portugal", 0x1002011a, 1, codeSetCharValues61, (short) 1); codeSetInfoArray_[62] = new CodeSetInfo( "IBM-284 (CCSID 00284); CECP for Spain, Latin America (Spanish)", 0x1002011c, 1, codeSetCharValues62, (short) 1); codeSetInfoArray_[63] = new CodeSetInfo( "IBM-285 (CCSID 00285); CECP for United Kingdom", 0x1002011d, 1, codeSetCharValues63, (short) 1); codeSetInfoArray_[64] = new CodeSetInfo( "IBM-290 (CCSID 00290); Japanese Katakana Host Ext SBCS", 0x10020122, 1, codeSetCharValues64, (short) 1); codeSetInfoArray_[65] = new CodeSetInfo( "IBM-297 (CCSID 00297); CECP for France", 0x10020129, 1, codeSetCharValues65, (short) 1); codeSetInfoArray_[66] = new CodeSetInfo( "IBM-300 (CCSID 00300); Japanese Host DBCS incl 4370 UDC", 0x1002012c, 1, codeSetCharValues66, (short) 2); codeSetInfoArray_[67] = new CodeSetInfo( "IBM-301 (CCSID 00301); Japanese PC Data DBCS incl 1880 UDC", 0x1002012d, 1, codeSetCharValues67, (short) 2); codeSetInfoArray_[68] = new CodeSetInfo( "IBM-420 (CCSID 00420); Arabic (presentation shapes)", 0x100201a4, 1, codeSetCharValues68, (short) 1); codeSetInfoArray_[69] = new CodeSetInfo( "IBM-424 (CCSID 00424); Hebrew", 0x100201a8, 1, codeSetCharValues69, (short) 1); codeSetInfoArray_[70] = new CodeSetInfo( "IBM-437 (CCSID 00437); PC USA", 0x100201b5, 1, codeSetCharValues70, (short) 1); codeSetInfoArray_[71] = new CodeSetInfo( "IBM-500 (CCSID 00500); CECP for Belgium, Switzerland", 0x100201f4, 1, codeSetCharValues71, (short) 1); codeSetInfoArray_[72] = new CodeSetInfo( "IBM-833 (CCSID 00833); Korean Host Extended SBCS", 0x10020341, 1, codeSetCharValues72, (short) 1); codeSetInfoArray_[73] = new CodeSetInfo( "IBM-834 (CCSID 00834); Korean Host DBCS incl 1227 UDC", 0x10020342, 1, codeSetCharValues73, (short) 2); codeSetInfoArray_[74] = new CodeSetInfo( "IBM-835 (CCSID 00835); T-Ch Host DBCS incl 6204 UDC", 0x10020343, 1, codeSetCharValues74, (short) 2); codeSetInfoArray_[75] = new CodeSetInfo( "IBM-836 (CCSID 00836); S-Ch Host Extended SBCS", 0x10020344, 1, codeSetCharValues75, (short) 1); codeSetInfoArray_[76] = new CodeSetInfo( "IBM-837 (CCSID 00837); S-Ch Host DBCS incl 1880 UDC", 0x10020345, 1, codeSetCharValues76, (short) 2); codeSetInfoArray_[77] = new CodeSetInfo( "IBM-838 (CCSID 00838); Thai Host Extended SBCS", 0x10020346, 1, codeSetCharValues77, (short) 1); codeSetInfoArray_[78] = new CodeSetInfo( "IBM-839 (CCSID 00839); Thai Host DBCS incl 374 UDC", 0x10020347, 1, codeSetCharValues78, (short) 2); codeSetInfoArray_[79] = new CodeSetInfo( "IBM-850 (CCSID 00850); Multilingual IBM PC Data-MLP 222", 0x10020352, 1, codeSetCharValues79, (short) 1); codeSetInfoArray_[80] = new CodeSetInfo( "IBM-852 (CCSID 00852); Multilingual Latin-2", 0x10020354, 1, codeSetCharValues80, (short) 1); codeSetInfoArray_[81] = new CodeSetInfo( "IBM-855 (CCSID 00855); Cyrillic PC Data", 0x10020357, 1, codeSetCharValues81, (short) 1); codeSetInfoArray_[82] = new CodeSetInfo( "IBM-856 (CCSID 00856); Hebrew PC Data (extensions)", 0x10020358, 1, codeSetCharValues82, (short) 1); codeSetInfoArray_[83] = new CodeSetInfo( "IBM-857 (CCSID 00857); Turkish Latin-5 PC Data", 0x10020359, 1, codeSetCharValues83, (short) 1); codeSetInfoArray_[84] = new CodeSetInfo( "IBM-861 (CCSID 00861); PC Data Iceland", 0x1002035d, 1, codeSetCharValues84, (short) 1); codeSetInfoArray_[85] = new CodeSetInfo( "IBM-862 (CCSID 00862); PC Data Hebrew", 0x1002035e, 1, codeSetCharValues85, (short) 1); codeSetInfoArray_[86] = new CodeSetInfo( "IBM-863 (CCSID 00863); PC Data Canadian French", 0x1002035f, 1, codeSetCharValues86, (short) 1); codeSetInfoArray_[87] = new CodeSetInfo( "IBM-864 (CCSID 00864); Arabic PC Data", 0x10020360, 1, codeSetCharValues87, (short) 1); codeSetInfoArray_[88] = new CodeSetInfo( "IBM-866 (CCSID 00866); PC Data Cyrillic 2", 0x10020362, 1, codeSetCharValues88, (short) 1); codeSetInfoArray_[89] = new CodeSetInfo( "IBM-868 (CCSID 00868); Urdu PC Data", 0x10020364, 1, codeSetCharValues89, (short) 1); codeSetInfoArray_[90] = new CodeSetInfo( "IBM-869 (CCSID 00869); Greek PC Data", 0x10020365, 1, codeSetCharValues90, (short) 1); codeSetInfoArray_[91] = new CodeSetInfo( "IBM-870 (CCSID 00870); Multilingual Latin-2 EBCDIC", 0x10020366, 1, codeSetCharValues91, (short) 1); codeSetInfoArray_[92] = new CodeSetInfo( "IBM-871 (CCSID 00871); CECP for Iceland", 0x10020367, 1, codeSetCharValues92, (short) 1); codeSetInfoArray_[93] = new CodeSetInfo( "IBM-874 (CCSID 00874); Thai PC Display Extended SBCS", 0x1002036a, 1, codeSetCharValues93, (short) 1); codeSetInfoArray_[94] = new CodeSetInfo("IBM-875 (CCSID 00875); Greek", 0x1002036b, 1, codeSetCharValues94, (short) 1); codeSetInfoArray_[95] = new CodeSetInfo( "IBM-880 (CCSID 00880); Multilingual Cyrillic", 0x10020370, 1, codeSetCharValues95, (short) 1); codeSetInfoArray_[96] = new CodeSetInfo( "IBM-891 (CCSID 00891); Korean PC Data SBCS", 0x1002037b, 1, codeSetCharValues96, (short) 1); codeSetInfoArray_[97] = new CodeSetInfo( "IBM-896 (CCSID 00896); Japanese Katakana characters; superset of JIS X0201:1976", 0x10020380, 1, codeSetCharValues97, (short) 1); codeSetInfoArray_[98] = new CodeSetInfo( "IBM-897 (CCSID 00897); PC Data Japanese SBCS (use with CP 00301)", 0x10020381, 1, codeSetCharValues98, (short) 1); codeSetInfoArray_[99] = new CodeSetInfo( "IBM-903 (CCSID 00903); PC Data Simplified Chinese SBCS (use with DBCS)", 0x10020387, 1, codeSetCharValues99, (short) 1); codeSetInfoArray_[100] = new CodeSetInfo( "IBM-904 (CCSID 00904); PC Data Traditional Chinese SBCS (use with DBCS)", 0x10020388, 1, codeSetCharValues100, (short) 1); codeSetInfoArray_[101] = new CodeSetInfo("IBM-918 (CCSID 00918); Urdu", 0x10020396, 1, codeSetCharValues101, (short) 1); codeSetInfoArray_[102] = new CodeSetInfo( "IBM-921 (CCSID 00921); Baltic 8-Bit", 0x10020399, 1, codeSetCharValues102, (short) 1); codeSetInfoArray_[103] = new CodeSetInfo( "IBM-922 (CCSID 00922); Estonia 8-Bit", 0x1002039a, 1, codeSetCharValues103, (short) 1); codeSetInfoArray_[104] = new CodeSetInfo( "IBM-926 (CCSID 00926); Korean PC Data DBCS incl 1880 UDC", 0x1002039e, 1, codeSetCharValues104, (short) 2); codeSetInfoArray_[105] = new CodeSetInfo( "IBM-927 (CCSID 00927); T-Ch PC Data DBCS incl 6204 UDC", 0x1002039f, 1, codeSetCharValues105, (short) 2); codeSetInfoArray_[106] = new CodeSetInfo( "IBM-928 (CCSID 00928); S-Ch PC Data DBCS incl 1880 UDC", 0x100203a0, 1, codeSetCharValues106, (short) 2); codeSetInfoArray_[107] = new CodeSetInfo( "IBM-929 (CCSID 00929); Thai PC Data DBCS incl 374 UDC", 0x100203a1, 1, codeSetCharValues107, (short) 2); codeSetInfoArray_[108] = new CodeSetInfo( "IBM-930 (CCSID 00930); Kat-Kanji Host MBCS Ext-SBCS", 0x100203a2, 2, codeSetCharValues108, (short) 2); codeSetInfoArray_[109] = new CodeSetInfo( "IBM-932 (CCSID 00932); Japanese PC Data Mixed", 0x100203a4, 2, codeSetCharValues109, (short) 2); codeSetInfoArray_[110] = new CodeSetInfo( "IBM-933 (CCSID 00933); Korean Host Extended SBCS", 0x100203a5, 2, codeSetCharValues110, (short) 2); codeSetInfoArray_[111] = new CodeSetInfo( "IBM-934 (CCSID 00934); Korean PC Data Mixed", 0x100203a6, 2, codeSetCharValues111, (short) 2); codeSetInfoArray_[112] = new CodeSetInfo( "IBM-935 (CCSID 00935); S-Ch Host Mixed", 0x100203a7, 2, codeSetCharValues112, (short) 2); codeSetInfoArray_[113] = new CodeSetInfo( "IBM-936 (CCSID 00936); PC Data S-Ch MBCS", 0x100203a8, 2, codeSetCharValues113, (short) 2); codeSetInfoArray_[114] = new CodeSetInfo( "IBM-937 (CCSID 00937); T-Ch Host Mixed", 0x100203a9, 2, codeSetCharValues114, (short) 2); codeSetInfoArray_[115] = new CodeSetInfo( "IBM-938 (CCSID 00938); PC Data T-Ch MBCS", 0x100203aa, 2, codeSetCharValues115, (short) 2); codeSetInfoArray_[116] = new CodeSetInfo( "IBM-939 (CCSID 00939); Latin-Kanji Host MBCS", 0x100203ab, 2, codeSetCharValues116, (short) 2); codeSetInfoArray_[117] = new CodeSetInfo( "IBM-941 (CCSID 00941); Japanese PC DBCS for Open", 0x100203ad, 1, codeSetCharValues117, (short) 2); codeSetInfoArray_[118] = new CodeSetInfo( "IBM-942 (CCSID 00942); Japanese PC Data Mixed", 0x100203ae, 2, codeSetCharValues118, (short) 2); codeSetInfoArray_[119] = new CodeSetInfo( "IBM-943 (CCSID 00943); Japanese PC MBCS for Open", 0x100203af, 2, codeSetCharValues119, (short) 2); codeSetInfoArray_[120] = new CodeSetInfo( "IBM-946 (CCSID 00946); S-Ch PC Data Mixed", 0x100203b2, 2, codeSetCharValues120, (short) 2); codeSetInfoArray_[121] = new CodeSetInfo( "IBM-947 (CCSID 00947); T-Ch PC Data DBCS incl 6204 UDC", 0x100203b3, 1, codeSetCharValues121, (short) 2); codeSetInfoArray_[122] = new CodeSetInfo( "IBM-948 (CCSID 00948); T-Ch PC Data Mixed", 0x100203b4, 2, codeSetCharValues122, (short) 2); codeSetInfoArray_[123] = new CodeSetInfo( "IBM-949 (CCSID 00949); IBM KS PC Data Mixed", 0x100203b5, 2, codeSetCharValues123, (short) 2); codeSetInfoArray_[124] = new CodeSetInfo( "IBM-950 (CCSID 00950); T-Ch PC Data Mixed", 0x100203b6, 2, codeSetCharValues124, (short) 2); codeSetInfoArray_[125] = new CodeSetInfo( "IBM-951 (CCSID 00951); IBM KS PC Data DBCS incl 1880 UDC", 0x100203b7, 1, codeSetCharValues125, (short) 2); codeSetInfoArray_[126] = new CodeSetInfo( "IBM-955 (CCSID 00955); Japan Kanji characters; superset of JIS X0208:1978", 0x100203bb, 1, codeSetCharValues126, (short) 2); codeSetInfoArray_[127] = new CodeSetInfo( "IBM-964 (CCSID 00964); T-Chinese EUC CNS1163 plane 1,2", 0x100203c4, 2, codeSetCharValues127, (short) 4); codeSetInfoArray_[128] = new CodeSetInfo( "IBM-970 (CCSID 00970); Korean EUC", 0x100203ca, 3, codeSetCharValues128, (short) 2); codeSetInfoArray_[129] = new CodeSetInfo( "IBM-1006 (CCSID 01006); Urdu 8-bit", 0x100203ee, 1, codeSetCharValues129, (short) 1); codeSetInfoArray_[130] = new CodeSetInfo( "IBM-1025 (CCSID 01025); Cyrillic Multilingual", 0x10020401, 1, codeSetCharValues130, (short) 1); codeSetInfoArray_[131] = new CodeSetInfo( "IBM-1026 (CCSID 01026); Turkish Latin-5", 0x10020402, 1, codeSetCharValues131, (short) 1); codeSetInfoArray_[132] = new CodeSetInfo( "IBM-1027 (CCSID 01027); Japanese Latin Host Ext SBCS", 0x10020403, 1, codeSetCharValues132, (short) 1); codeSetInfoArray_[133] = new CodeSetInfo( "IBM-1040 (CCSID 01040); Korean PC Data Extended SBCS", 0x10020410, 1, codeSetCharValues133, (short) 1); codeSetInfoArray_[134] = new CodeSetInfo( "IBM-1041 (CCSID 01041); Japanese PC Data Extended SBCS", 0x10020411, 1, codeSetCharValues134, (short) 1); codeSetInfoArray_[135] = new CodeSetInfo( "IBM-1043 (CCSID 01043); T-Ch PC Data Extended SBCS", 0x10020413, 1, codeSetCharValues135, (short) 1); codeSetInfoArray_[136] = new CodeSetInfo( "IBM-1046 (CCSID 01046); Arabic PC Data", 0x10020416, 1, codeSetCharValues136, (short) 1); codeSetInfoArray_[137] = new CodeSetInfo( "IBM-1047 (CCSID 01047); Latin-1 Open System", 0x10020417, 1, codeSetCharValues137, (short) 1); codeSetInfoArray_[138] = new CodeSetInfo( "IBM-1088 (CCSID 01088); IBM KS Code PC Data SBCS", 0x10020440, 1, codeSetCharValues138, (short) 1); codeSetInfoArray_[139] = new CodeSetInfo( "IBM-1097 (CCSID 01097); Farsi", 0x10020449, 1, codeSetCharValues139, (short) 1); codeSetInfoArray_[140] = new CodeSetInfo( "IBM-1098 (CCSID 01098); Farsi PC Data", 0x1002044a, 1, codeSetCharValues140, (short) 1); codeSetInfoArray_[141] = new CodeSetInfo( "IBM-1112 (CCSID 01112); Baltic Multilingual", 0x10020458, 1, codeSetCharValues141, (short) 1); codeSetInfoArray_[142] = new CodeSetInfo( "IBM-1114 (CCSID 01114); T-Ch PC Data SBCS (IBM BIG-5)", 0x1002045a, 1, codeSetCharValues142, (short) 1); codeSetInfoArray_[143] = new CodeSetInfo( "IBM-1115 (CCSID 01115); S-Ch PC Data SBCS (IBM GB)", 0x1002045b, 1, codeSetCharValues143, (short) 1); codeSetInfoArray_[144] = new CodeSetInfo( "IBM-1122 (CCSID 01122); Estonia", 0x10020462, 1, codeSetCharValues144, (short) 1); codeSetInfoArray_[145] = new CodeSetInfo( "IBM-1250 (CCSID 01250); MS Windows Latin-2", 0x100204e2, 1, codeSetCharValues145, (short) 1); codeSetInfoArray_[146] = new CodeSetInfo( "IBM-1251 (CCSID 01251); MS Windows Cyrillic", 0x100204e3, 1, codeSetCharValues146, (short) 1); codeSetInfoArray_[147] = new CodeSetInfo( "IBM-1252 (CCSID 01252); MS Windows Latin-1", 0x100204e4, 1, codeSetCharValues147, (short) 1); codeSetInfoArray_[148] = new CodeSetInfo( "IBM-1253 (CCSID 01253); MS Windows Greek", 0x100204e5, 1, codeSetCharValues148, (short) 1); codeSetInfoArray_[149] = new CodeSetInfo( "IBM-1254 (CCSID 01254); MS Windows Turkey", 0x100204e6, 1, codeSetCharValues149, (short) 1); codeSetInfoArray_[150] = new CodeSetInfo( "IBM-1255 (CCSID 01255); MS Windows Hebrew", 0x100204e7, 1, codeSetCharValues150, (short) 1); codeSetInfoArray_[151] = new CodeSetInfo( "IBM-1256 (CCSID 01256); MS Windows Arabic", 0x100204e8, 1, codeSetCharValues151, (short) 1); codeSetInfoArray_[152] = new CodeSetInfo( "IBM-1257 (CCSID 01257); MS Windows Baltic", 0x100204e9, 1, codeSetCharValues152, (short) 1); codeSetInfoArray_[153] = new CodeSetInfo( "IBM-1380 (CCSID 01380); S-Ch PC Data DBCS incl 1880 UDC", 0x10020564, 1, codeSetCharValues153, (short) 2); codeSetInfoArray_[154] = new CodeSetInfo( "IBM-1381 (CCSID 01381); S-Ch PC Data Mixed incl 1880 UDC", 0x10020565, 2, codeSetCharValues154, (short) 2); codeSetInfoArray_[155] = new CodeSetInfo( "IBM-1383 (CCSID 01383); S-Ch EUC GB 2312-80 set (1382)", 0x10020567, 2, codeSetCharValues155, (short) 3); codeSetInfoArray_[156] = new CodeSetInfo( "IBM-300 (CCSID 04396); Japanese Host DBCS incl 1880 UDC", 0x1002112c, 1, codeSetCharValues156, (short) 2); codeSetInfoArray_[157] = new CodeSetInfo( "IBM-850 (CCSID 04946); Multilingual IBM PC Data-190", 0x10021352, 1, codeSetCharValues157, (short) 1); codeSetInfoArray_[158] = new CodeSetInfo( "IBM-852 (CCSID 04948); Latin-2 Personal Computer", 0x10021354, 1, codeSetCharValues158, (short) 1); codeSetInfoArray_[159] = new CodeSetInfo( "IBM-855 (CCSID 04951); Cyrillic Personal Computer", 0x10021357, 1, codeSetCharValues159, (short) 1); codeSetInfoArray_[160] = new CodeSetInfo( "IBM-856 (CCSID 04952); Hebrew PC Data", 0x10021358, 1, codeSetCharValues160, (short) 1); codeSetInfoArray_[161] = new CodeSetInfo( "IBM-857 (CCSID 04953); Turkish Latin-5 PC Data", 0x10021359, 1, codeSetCharValues161, (short) 1); codeSetInfoArray_[162] = new CodeSetInfo( "IBM-864 (CCSID 04960); Arabic PC Data (all shapes)", 0x10021360, 1, codeSetCharValues162, (short) 1); codeSetInfoArray_[163] = new CodeSetInfo( "IBM-868 (CCSID 04964); PC Data for Urdu", 0x10021364, 1, codeSetCharValues163, (short) 1); codeSetInfoArray_[164] = new CodeSetInfo( "IBM-869 (CCSID 04965); Greek PC Data", 0x10021365, 1, codeSetCharValues164, (short) 1); codeSetInfoArray_[165] = new CodeSetInfo( "IBM-5026 (CCSID 05026); Japanese Katakana-Kanji Host Mixed", 0x100213a2, 2, codeSetCharValues165, (short) 2); codeSetInfoArray_[166] = new CodeSetInfo( "IBM-5031 (CCSID 05031); S-Ch Host MBCS", 0x100213a7, 2, codeSetCharValues166, (short) 2); codeSetInfoArray_[167] = new CodeSetInfo( "IBM-1027 and -300 (CCSID 05035); Japanese Latin-Kanji Host Mixed", 0x100213ab, 2, codeSetCharValues167, (short) 2); codeSetInfoArray_[168] = new CodeSetInfo( "IBM-5048 (CCSID 05048); Japanese Kanji characters; superset of JIS X0208:1990 (and 1983)", 0x100213b8, 1, codeSetCharValues168, (short) 2); codeSetInfoArray_[169] = new CodeSetInfo( "IBM-5049 (CCSID 05049); Japanese Kanji characters; superset of JIS X0212:1990", 0x100213b9, 1, codeSetCharValues169, (short) 2); codeSetInfoArray_[170] = new CodeSetInfo( "IBM-5067 (CCSID 05067); Korean Hangul and Hanja; superset of KS C5601:1987", 0x100213cb, 1, codeSetCharValues170, (short) 2); codeSetInfoArray_[171] = new CodeSetInfo( "IBM-420 (CCSID 08612); Arabic (base shapes only)", 0x100221a4, 1, codeSetCharValues171, (short) 1); codeSetInfoArray_[172] = new CodeSetInfo( "IBM-833 (CCSID 09025); Korean Host SBCS", 0x10022341, 1, codeSetCharValues172, (short) 1); codeSetInfoArray_[173] = new CodeSetInfo( "IBM-834 (CCSID 09026); Korean Host DBCS incl 1880 UDC", 0x10022342, 1, codeSetCharValues173, (short) 2); codeSetInfoArray_[174] = new CodeSetInfo( "IBM-838 (CCSID 09030); Thai Host Extended SBCS", 0x10022346, 1, codeSetCharValues174, (short) 1); codeSetInfoArray_[175] = new CodeSetInfo( "IBM-864 (CCSID 09056); Arabic PC Data (unshaped)", 0x10022360, 1, codeSetCharValues175, (short) 1); codeSetInfoArray_[176] = new CodeSetInfo( "IBM-874 (CCSID 09066); Thai PC Display Extended SBCS", 0x1002236a, 1, codeSetCharValues176, (short) 1); codeSetInfoArray_[177] = new CodeSetInfo( "IBM-9125 (CCSID 09125); Korean Host Mixed incl 1880 UDC", 0x100223a5, 2, codeSetCharValues177, (short) 2); codeSetInfoArray_[178] = new CodeSetInfo( "IBM-850 (CCSID 25426); Multilingual IBM PC Display-MLP", 0x10026352, 1, codeSetCharValues178, (short) 1); codeSetInfoArray_[179] = new CodeSetInfo( "IBM-856 (CCSID 25432); Hebrew PC Display (extensions)", 0x10026358, 1, codeSetCharValues179, (short) 1); codeSetInfoArray_[180] = new CodeSetInfo( "IBM-1042 (CCSID 25618); S-Ch PC Display Ext SBCS", 0x10026412, 1, codeSetCharValues180, (short) 1); codeSetInfoArray_[181] = new CodeSetInfo( "IBM-037 (CCSID 28709); T-Ch Host Extended SBCS", 0x10027025, 1, codeSetCharValues181, (short) 1); codeSetInfoArray_[182] = new CodeSetInfo( "IBM-856 (CCSID 33624); Hebrew PC Display", 0x10028358, 1, codeSetCharValues182, (short) 1); codeSetInfoArray_[183] = new CodeSetInfo( "IBM33722 (CCSID 33722); Japanese EUC JISx201,208,212", 0x100283ba, 3, codeSetCharValues183, (short) 3); codeSetInfoArray_[184] = new CodeSetInfo("HTCsjis; Hitachi SJIS 90-1", 0x10030001, 3, codeSetCharValues184, (short) 2); codeSetInfoArray_[185] = new CodeSetInfo("HTCujis; Hitachi eucJP 90-1", 0x10030002, 3, codeSetCharValues185, (short) 2); codeSetInfoArray_[186] = new CodeSetInfo("Fujitsu U90; Japanese EUC", 0x10040001, 3, codeSetCharValues186, (short) 3); codeSetInfoArray_[187] = new CodeSetInfo("Fujitsu S90; Japanese EUC", 0x10040002, 3, codeSetCharValues187, (short) 3); codeSetInfoArray_[188] = new CodeSetInfo( "Fujitsu R90; Fujitsu Shift JIS", 0x10040003, 3, codeSetCharValues188, (short) 2); codeSetInfoArray_[189] = new CodeSetInfo( "EBCDIC(ASCII) and JEF; Japanese encoding method for mainframe", 0x10040004, 2, codeSetCharValues189, (short) 3); codeSetInfoArray_[190] = new CodeSetInfo( "EBCDIC(Katakana) and JEF; Japanese encoding method for mainframe", 0x10040005, 3, codeSetCharValues190, (short) 3); codeSetInfoArray_[191] = new CodeSetInfo( "EBCDIC(Japanese English) and JEF; Japanese encoding method for mainframe", 0x10040006, 2, codeSetCharValues191, (short) 3); } }
6,297
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPConnectionClosed.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; final public class GIOPConnectionClosed extends Exception { }
6,298
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeBaseProxy.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.yoko.orb.OB; import org.apache.yoko.orb.CORBA.InputStream; import org.apache.yoko.orb.OCI.Buffer; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.LocalObject; import org.omg.CORBA.Repository; import org.omg.CORBA.ValueDefPackage.FullValueDescription; import org.omg.CORBA.portable.ObjectImpl; import org.omg.IOP.ServiceContext; import org.omg.SendingContext.CodeBase; public class CodeBaseProxy extends LocalObject implements CodeBase { final ORBInstance orbInstance_; ServiceContext ctx; CodeBase codebase; CodeBaseProxy(ORBInstance orb, ServiceContext ctx) { if (ctx.context_id != org.omg.IOP.SendingContextRunTime.value) { throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorInvalidContextID), org.apache.yoko.orb.OB.MinorCodes.MinorInvalidContextID, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } this.orbInstance_ = orb; this.ctx = ctx; } /* (non-Javadoc) * @see org.omg.SendingContext.CodeBaseOperations#implementation(java.lang.String) */ public String implementation(String arg0) { return getCodeBase(orbInstance_).implementation(arg0); } /* (non-Javadoc) * @see org.omg.SendingContext.CodeBaseOperations#implementations(java.lang.String[]) */ public String[] implementations(String[] arg0) { return getCodeBase(orbInstance_).implementations(arg0); } /* (non-Javadoc) * @see org.omg.SendingContext.CodeBaseOperations#bases(java.lang.String) */ public String[] bases(String arg0) { return getCodeBase(orbInstance_).bases(arg0); } /* (non-Javadoc) * @see org.omg.SendingContext.CodeBaseOperations#get_ir() */ public Repository get_ir() { return getCodeBase(orbInstance_).get_ir(); } /* (non-Javadoc) * @see org.omg.SendingContext.CodeBaseOperations#meta(java.lang.String) */ public FullValueDescription meta(String arg0) { return getCodeBase(orbInstance_).meta(arg0); } /* (non-Javadoc) * @see org.omg.SendingContext.CodeBaseOperations#metas(java.lang.String) */ public FullValueDescription[] metas(String arg0) { return getCodeBase(orbInstance_).metas(arg0); } public CodeBase getCodeBase() { return getCodeBase(orbInstance_); } private CodeBase getCodeBase(ORBInstance orb) { if (codebase == null || getorb(codebase) != orb.getORB()) { byte[] coct = ctx.context_data; Buffer buf = new Buffer(coct, coct.length); InputStream in = new InputStream(buf); in._OB_ORBInstance(orb); in._OB_readEndian(); org.omg.CORBA.Object obj = in.read_Object(); try { codebase = org.omg.SendingContext.CodeBaseHelper.narrow(obj); } catch (BAD_PARAM ex) { codebase = null; } ctx = null; } // TODO: add minor code // return codebase; } /** * @param codebase * @return */ private org.omg.CORBA.ORB getorb(org.omg.CORBA.Object codebase) { if (codebase instanceof ObjectImpl) { return ((ObjectImpl)codebase)._orb(); } else { return null; } } }
6,299