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
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OBPortableServer/GIOPVersionPolicyHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/GIOPVersionPolicy:1.0 // final public class GIOPVersionPolicyHelper { public static void insert(org.omg.CORBA.Any any, GIOPVersionPolicy val) { any.insert_Object(val, type()); } public static GIOPVersionPolicy 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(), "GIOPVersionPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/GIOPVersionPolicy:1.0"; } public static GIOPVersionPolicy 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, GIOPVersionPolicy 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 GIOPVersionPolicy narrow(org.omg.CORBA.Object val) { try { return (GIOPVersionPolicy)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,800
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/OBPortableServer/InterceptorCallPolicyHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/InterceptorCallPolicy:1.0 // final public class InterceptorCallPolicyHelper { public static void insert(org.omg.CORBA.Any any, InterceptorCallPolicy val) { any.insert_Object(val, type()); } public static InterceptorCallPolicy 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(), "InterceptorCallPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/InterceptorCallPolicy:1.0"; } public static InterceptorCallPolicy 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, InterceptorCallPolicy 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 InterceptorCallPolicy narrow(org.omg.CORBA.Object val) { try { return (InterceptorCallPolicy)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,801
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/OBPortableServer/CommunicationsConcurrencyPolicy_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.OBPortableServer; import org.apache.yoko.orb.OBPortableServer.COMMUNICATIONS_CONCURRENCY_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.CommunicationsConcurrencyPolicy; public final class CommunicationsConcurrencyPolicy_impl extends org.omg.CORBA.LocalObject implements CommunicationsConcurrencyPolicy { private short value_; public CommunicationsConcurrencyPolicy_impl(short value) { value_ = value; } public short value() { return value_; } public int policy_type() { return COMMUNICATIONS_CONCURRENCY_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,802
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/OBPortableServer/COMMUNICATIONS_CONCURRENCY_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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/COMMUNICATIONS_CONCURRENCY_POLICY_ID:1.0 // /** * * This policy type identifies the communications concurrency policy. * **/ public interface COMMUNICATIONS_CONCURRENCY_POLICY_ID { int value = (int)(1330577668L); }
6,803
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/OBPortableServer/GIOPVersionPolicyHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/GIOPVersionPolicy:1.0 // final public class GIOPVersionPolicyHolder implements org.omg.CORBA.portable.Streamable { public GIOPVersionPolicy value; public GIOPVersionPolicyHolder() { } public GIOPVersionPolicyHolder(GIOPVersionPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = GIOPVersionPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { GIOPVersionPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return GIOPVersionPolicyHelper.type(); } }
6,804
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/OBPortableServer/InterceptorCallPolicyHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/InterceptorCallPolicy:1.0 // final public class InterceptorCallPolicyHolder implements org.omg.CORBA.portable.Streamable { public InterceptorCallPolicy value; public InterceptorCallPolicyHolder() { } public InterceptorCallPolicyHolder(InterceptorCallPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = InterceptorCallPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { InterceptorCallPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return InterceptorCallPolicyHelper.type(); } }
6,805
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/OBPortableServer/POAManagerOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManager:1.0 // /** * * This interface is a proprietary extension to the standard POAManager. * * @see PortableServer::POAManager * **/ public interface POAManagerOperations extends org.omg.PortableServer.POAManagerOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/POAManager/get_acceptors:1.0 // /** * * Retrieve the acceptors associated with this POAManager. * * @return The acceptors. * **/ org.apache.yoko.orb.OCI.Acceptor[] get_acceptors() throws org.omg.PortableServer.POAManagerPackage.AdapterInactive; }
6,806
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/OBPortableServer/EndpointConfigurationPolicyOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/EndpointConfigurationPolicy:1.0 // /** * * Endpoint Configuration Policy * **/ public interface EndpointConfigurationPolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/EndpointConfigurationPolicy/value:1.0 // /***/ AcceptorConfig[] value(); }
6,807
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/OBPortableServer/DefaultServantHolder.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.OBPortableServer; class DefaultServantHolder { private boolean destroyed_; org.omg.PortableServer.Servant servant_; // // Destroy the default servant // synchronized void destroy() { servant_ = null; } // // Set the default servant // synchronized public void setDefaultServant( org.omg.PortableServer.Servant servant) { servant_ = servant; } // // Retrieve the default servant // synchronized public org.omg.PortableServer.Servant getDefaultServant() { return servant_; } // // Retrieve the ObjectId associated with the servant, if necessary // synchronized byte[] servantToId(org.omg.PortableServer.Servant servant, org.apache.yoko.orb.PortableServer.Current_impl poaCurrent) { if (servant != servant_) return null; if (poaCurrent._OB_inUpcall() && poaCurrent._OB_getServant() == servant) { try { return poaCurrent.get_object_id(); } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); // TODO: // Internal // error } } return null; } }
6,808
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/OBPortableServer/SYNCHRONIZATION_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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SYNCHRONIZATION_POLICY_ID:1.0 // /** * * This policy type identifies the synchronization policy. * **/ public interface SYNCHRONIZATION_POLICY_ID { int value = (int)(1330577665L); }
6,809
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/OBPortableServer/ServantLocationStrategy.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.OBPortableServer; interface ServantLocationStrategy { // // Destroy the ServantLocatioStrategy // void destroy(org.omg.PortableServer.POA poa, boolean etherealize); // // Etherealize the ServantLocatioStrategy // void etherealize(org.omg.PortableServer.POA poa); // // Register the servant with the ObjectId // void activate(byte[] oid, org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.ServantAlreadyActive, org.omg.PortableServer.POAPackage.WrongPolicy, org.omg.PortableServer.POAPackage.ObjectAlreadyActive; // // Unregister the servant with the ObjectId // void deactivate(org.omg.PortableServer.POA poa, byte[] oid) throws org.omg.PortableServer.POAPackage.ObjectNotActive, org.omg.PortableServer.POAPackage.WrongPolicy; // // Return the ObjectId associated with the Servant // byte[] servantToId(org.omg.PortableServer.Servant servant, org.apache.yoko.orb.PortableServer.Current_impl poaCurrent); // // Return the Servant associated with the ObjectId // org.omg.PortableServer.Servant idToServant(byte[] oid, boolean useDefaultServant); // // Locate the servant with the ObjectId // org.omg.PortableServer.Servant locate(byte[] oid, org.omg.PortableServer.POA poa, String op, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) throws org.apache.yoko.orb.OB.LocationForward; // // About to call a method on the Servant // void preinvoke(byte[] oid); // // Completed calling a method on the Servant // void postinvoke(byte[] oid, org.omg.PortableServer.POA poa, String op, java.lang.Object cookie, org.omg.PortableServer.Servant servant); // // Create a DirectStubImpl for the ObjectId // DirectServant createDirectStubImpl(org.omg.PortableServer.POA poa, byte[] oid, org.apache.yoko.orb.OB.RefCountPolicyList policies) throws org.apache.yoko.orb.OB.LocationForward; // // Destroy a DirectStubImpl for the ObjectId // void removeDirectStubImpl(byte[] oid, DirectServant directServant); // // Retrieve the servant manager strategy // ServantManagerStrategy getServantManagerStrategy(); // // Retrieve the default servant holder // DefaultServantHolder getDefaultServantHolder(); }
6,810
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/OBPortableServer/ActiveObjectOnlyStrategy.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.OBPortableServer; // // Mapping for ObjectId to a sequence of DirectStubImpl // class DirectSeqEntry { private java.util.Vector seq_; private byte[] oid_; // TODO: tmp private void traceoid() { org.apache.yoko.orb.OB.Util.printOctets(System.out, oid_, 0, oid_.length); } DirectSeqEntry(byte[] oid) { seq_ = new java.util.Vector(); oid_ = oid; } protected void finalize() throws Throwable { deactivate(); super.finalize(); } void deactivate() { // traceoid(); // System.out.println("deactivate: "); for (int i = 0; i < seq_.size(); i++) ((DirectServant) seq_.elementAt(i)).deactivate(); seq_.removeAllElements(); } void add(DirectServant directServant) { // traceoid(); // System.out.println("add: " + directServant); seq_.addElement(directServant); } boolean remove(DirectServant directServant) { // traceoid(); // System.out.println("remove: " + directServant); for (int i = 0; i < seq_.size(); i++) { if (seq_.elementAt(i) == directServant) { seq_.removeElementAt(i); return seq_.isEmpty(); } } return false; } } // // If USE_ACTIVE_OBJECT_MAP_ONLY this strategy is used // class ActiveObjectOnlyStrategy implements ServantLocationStrategy { // // The AOM // protected java.util.Hashtable activeObjectTable_; // // Reverse map from servant to id // protected java.util.Hashtable servantIdTable_; // // Mapping for ObjectId's to DirectStubImpl // private java.util.Hashtable directSeqTable_; // // The ORBInstance // private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // // This method is synchronized on the TableEntry // protected void completeActivation( org.apache.yoko.orb.OB.ObjectIdHasher oid, org.omg.PortableServer.Servant servant, TableEntry entry) { // // If there is a DirectStubImpl that refers to a default servant // under this oid then deactivate each // synchronized (directSeqTable_) { DirectSeqEntry table; table = (DirectSeqEntry) directSeqTable_.get(oid); if (table != null) { table.deactivate(); directSeqTable_.remove(oid); } } // // If using UNIQUE_ID add the servant to the servantIdTable // if (servantIdTable_ != null) { org.apache.yoko.orb.OB.Assert._OB_assert(!servantIdTable_ .containsKey(servant)); servantIdTable_.put(servant, oid.getObjectId()); } // // Set the servant's delegate // ((org.omg.CORBA_2_3.ORB) orbInstance_.getORB()).set_delegate(servant); // // Update the object entry // entry.setServant(servant); entry.setActive(); } protected void completeDeactivate(org.omg.PortableServer.POA poa, org.apache.yoko.orb.OB.ObjectIdHasher oid, TableEntry entry) { // // Mark each DirectServant associated with this oid as // deactivated // synchronized (directSeqTable_) { DirectSeqEntry table = (DirectSeqEntry) directSeqTable_.get(oid); if (table != null) { table.deactivate(); directSeqTable_.remove(oid); } } // // If we're using UNIQUE_ID then remove the servant from the // servantIdTable // if (servantIdTable_ != null) { org.omg.PortableServer.Servant servant = entry.getServant(); org.apache.yoko.orb.OB.Assert._OB_assert(servantIdTable_ .containsKey(servant)); servantIdTable_.remove(servant); } // // Release the servant reference before calling etherealize and // mark the entry as deactivated. // entry.setDeactivated(); entry.clearServant(); } protected DirectServant completeDirectStubImpl( org.omg.PortableServer.POA poa, byte[] rawoid, org.omg.PortableServer.Servant servant, org.apache.yoko.orb.OB.RefCountPolicyList policies) { DirectServant directServant; org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); // // No direct invocations for DSI servants // if (servant instanceof org.omg.PortableServer.DynamicImplementation) return null; // // We must have direct invocations if the servant has native // types. Always use direct invocations, if possible, if there are // no interceptors installed. // // TODO: Check the POA interceptor policy // // We need this hack in Java because the servant class is // standardized, so we can't invoke _OB_haveNativeTypes(). // boolean haveNativeTypes = (servant instanceof org.omg.PortableServer.ServantManagerOperations); org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); if (!haveNativeTypes && (policies.locationTransparency == org.apache.yoko.orb.OB.LOCATION_TRANSPARENCY_STRICT.value || piManager.haveClientInterceptors() || piManager .haveServerInterceptors())) return null; // // Create a DirectServant // directServant = new DirectServant( (org.apache.yoko.orb.OBPortableServer.POA_impl) poa, oid .getObjectId(), servant); // // Add the DirectServant to the table // synchronized (directSeqTable_) { DirectSeqEntry table = (DirectSeqEntry) directSeqTable_.get(oid); if (table == null) { table = new DirectSeqEntry(oid.getObjectId()); directSeqTable_.put(oid, table); } table.add(directServant); } return directServant; } ActiveObjectOnlyStrategy( org.apache.yoko.orb.OBPortableServer.POAPolicies policies, org.apache.yoko.orb.OB.ORBInstance orbInstance) { activeObjectTable_ = new java.util.Hashtable(1023); directSeqTable_ = new java.util.Hashtable(1023); orbInstance_ = orbInstance; if (policies.idUniquenessPolicy() == org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID) servantIdTable_ = new java.util.Hashtable(1023); else servantIdTable_ = null; } public void destroy(org.omg.PortableServer.POA poa, boolean etherealize) { synchronized (activeObjectTable_) { activeObjectTable_.clear(); } synchronized (directSeqTable_) { directSeqTable_.clear(); } if (servantIdTable_ != null) servantIdTable_.clear(); } public void etherealize(org.omg.PortableServer.POA poa) { // Do nothing } public void activate(byte[] rawoid, org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.ServantAlreadyActive, org.omg.PortableServer.POAPackage.WrongPolicy, org.omg.PortableServer.POAPackage.ObjectAlreadyActive { org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); while (true) { boolean incarnate = false; TableEntry entry; // // Find out whether a servant is already bound under this id // if not add an entry into the AOM // synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(oid); if (entry == null) { // // If using UNIQUE_ID, then verify that the // servant isn't already activated. // if (servantIdTable_ != null && servantIdTable_.containsKey(servant)) { throw new org.omg.PortableServer.POAPackage.ServantAlreadyActive(); } // // Insert the servant in the active object table // with the provided id. // entry = new TableEntry(); activeObjectTable_.put(oid, entry); } } synchronized (entry) { switch (entry.state()) { case TableEntry.DEACTIVATE_PENDING: entry.waitForStateChange(); continue; case TableEntry.ACTIVATE_PENDING: incarnate = true; break; case TableEntry.ACTIVE: throw new org.omg.PortableServer.POAPackage.ObjectAlreadyActive(); case TableEntry.DEACTIVATED: break; } if (incarnate) { completeActivation(oid, servant, entry); return; } } } } public void deactivate(org.omg.PortableServer.POA poa, byte[] rawoid) throws org.omg.PortableServer.POAPackage.ObjectNotActive, org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); // // If no object in the active object table associated with // this key then raise an ObjectNotActive exception. // TableEntry entry; synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(oid); if (entry == null) throw new org.omg.PortableServer.POAPackage.ObjectNotActive(); } boolean deactivate = false; synchronized (entry) { switch (entry.state()) { case TableEntry.ACTIVE: entry.setDeactivatePending(); deactivate = entry.getOutstandingRequests() == 0; break; case TableEntry.DEACTIVATE_PENDING: return; case TableEntry.ACTIVATE_PENDING: case TableEntry.DEACTIVATED: throw new org.omg.PortableServer.POAPackage.ObjectNotActive(); } if (deactivate) { completeDeactivate(poa, oid, entry); // // Remove the entry from the active object map // synchronized (activeObjectTable_) { activeObjectTable_.remove(oid); } } } } public byte[] servantToId(org.omg.PortableServer.Servant servant, org.apache.yoko.orb.PortableServer.Current_impl poaCurrent) { byte[] id = null; if (servantIdTable_ != null) id = (byte[]) servantIdTable_.get(servant); return id; } public org.omg.PortableServer.Servant idToServant(byte[] rawoid, boolean useDefaultServant) { org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); while (true) { TableEntry entry; synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(oid); if (entry == null) return null; } synchronized (entry) { switch (entry.state()) { case TableEntry.DEACTIVATE_PENDING: case TableEntry.ACTIVATE_PENDING: entry.waitForStateChange(); continue; case TableEntry.ACTIVE: return entry.getServant(); case TableEntry.DEACTIVATED: return null; } } } } public org.omg.PortableServer.Servant locate(byte[] rawoid, org.omg.PortableServer.POA poa, String op, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) throws org.apache.yoko.orb.OB.LocationForward { org.omg.PortableServer.Servant servant = idToServant(rawoid, false); if (servant == null) { // // If the servant isn't in the table then this is an // OBJECT_NOT_EXIST exception // throw new org.omg.CORBA.OBJECT_NOT_EXIST( org.apache.yoko.orb.OB.MinorCodes .describeObjectNotExist(org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch), org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } return servant; } public void preinvoke(byte[] rawoid) { org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); TableEntry entry; synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(oid); if (entry == null) return; } synchronized (entry) { entry.incOutstandingRequest(); } } public void postinvoke(byte[] rawoid, org.omg.PortableServer.POA poa, String op, java.lang.Object cookie, org.omg.PortableServer.Servant servant) { org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); TableEntry entry; synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(oid); if (entry == null) return; } // // If the number of outstanding requests is now 0 and the // entry has been deactivated then complete the deactivation // boolean deactivate = false; synchronized (entry) { if (entry.decOutstandingRequest() == 0) deactivate = entry.state() == TableEntry.DEACTIVATE_PENDING; if (deactivate) { completeDeactivate(poa, oid, entry); // // Remove the entry for the active object map // synchronized (activeObjectTable_) { activeObjectTable_.remove(oid); } } } } public DirectServant createDirectStubImpl(org.omg.PortableServer.POA poa, byte[] oid, org.apache.yoko.orb.OB.RefCountPolicyList policies) throws org.apache.yoko.orb.OB.LocationForward { try { org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie = null; org.omg.PortableServer.Servant servant = locate(oid, poa, "", cookie); return completeDirectStubImpl(poa, oid, servant, policies); } catch (org.omg.CORBA.SystemException ex) { } return null; } public void removeDirectStubImpl(byte[] rawoid, DirectServant directStubImpl) { org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); synchronized (directSeqTable_) { DirectSeqEntry table = (DirectSeqEntry) directSeqTable_.get(oid); if (table != null) { if (table.remove(directStubImpl)) directSeqTable_.remove(oid); } } } public ServantManagerStrategy getServantManagerStrategy() { return null; } public DefaultServantHolder getDefaultServantHolder() { return null; } }
6,811
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/OBPortableServer/DispatchStrategyPolicy_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.OBPortableServer; import org.apache.yoko.orb.OBPortableServer.DISPATCH_STRATEGY_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.DispatchStrategyPolicy; public final class DispatchStrategyPolicy_impl extends org.omg.CORBA.LocalObject implements DispatchStrategyPolicy { private org.apache.yoko.orb.OB.DispatchStrategy value_; public DispatchStrategyPolicy_impl( org.apache.yoko.orb.OB.DispatchStrategy value) { value_ = value; } public org.apache.yoko.orb.OB.DispatchStrategy value() { return value_; } public int policy_type() { return DISPATCH_STRATEGY_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,812
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/OBPortableServer/SynchronizationPolicyValue.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicyValue:1.0 // /** * * This enumeration details the synchronization strategies for method * dispatch. * * @member NO_SYNCHRONIZATION No direct synchronization is applied * @member SYNCHRONIZE_ON_POA Method calls are synchronized on a POA * @member SYNCHRONIZE_ON_ORB Method calls are synchronized on the ORB * * @see SynchronizationPolicy * **/ public class SynchronizationPolicyValue implements org.omg.CORBA.portable.IDLEntity { private static SynchronizationPolicyValue [] values_ = new SynchronizationPolicyValue[3]; private int value_; public final static int _NO_SYNCHRONIZATION = 0; public final static SynchronizationPolicyValue NO_SYNCHRONIZATION = new SynchronizationPolicyValue(_NO_SYNCHRONIZATION); public final static int _SYNCHRONIZE_ON_POA = 1; public final static SynchronizationPolicyValue SYNCHRONIZE_ON_POA = new SynchronizationPolicyValue(_SYNCHRONIZE_ON_POA); public final static int _SYNCHRONIZE_ON_ORB = 2; public final static SynchronizationPolicyValue SYNCHRONIZE_ON_ORB = new SynchronizationPolicyValue(_SYNCHRONIZE_ON_ORB); protected SynchronizationPolicyValue(int value) { values_[value] = this; value_ = value; } public int value() { return value_; } public static SynchronizationPolicyValue from_int(int value) { if(value < values_.length) return values_[value]; else throw new org.omg.CORBA.BAD_PARAM("Value (" + value + ") out of range", 25, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } private java.lang.Object readResolve() throws java.io.ObjectStreamException { return from_int(value()); } }
6,813
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/OBPortableServer/GIOP_VERSION_POLICY_1_1.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/GIOP_VERSION_POLICY_1_1:1.0 // /** * * The <code>GIOP_VERSION_POLICY_1_1</code> GIOPVersionPolicy value. * **/ public interface GIOP_VERSION_POLICY_1_1 { short value = (short)(1L); }
6,814
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/OBPortableServer/DispatchStrategyPolicyOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/DispatchStrategyPolicy:1.0 // /** * * The dispatch strategy policy. This policy controls the method * dispatch strategy. * * @see OB::DispatchStrategy * **/ public interface DispatchStrategyPolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/DispatchStrategyPolicy/value:1.0 // /** * * The DispatchStrategy value. * **/ org.apache.yoko.orb.OB.DispatchStrategy value(); }
6,815
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/OBPortableServer/ServantDispatcher.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.OBPortableServer; // // There are several ways a request can be dispatched in Java: // // 1) Portable stream-based skeleton // 2) DSI // 3) Proprietary skeleton // // We cannot simply invoke _OB_dispatch() on the servant, because // org.omg.PortableServer.Servant is standardized. // // To support portable skeletons, this class also implements the // standard ResponseHandler interface. // final class ServantDispatcher implements org.omg.CORBA.portable.ResponseHandler { // // The Upcall // protected org.apache.yoko.orb.OB.Upcall upcall_; // // The servant // protected org.omg.PortableServer.Servant servant_; // // Used to bypass a portable skeleton // private class Abort extends RuntimeException { } ServantDispatcher(org.apache.yoko.orb.OB.Upcall upcall, org.omg.PortableServer.Servant servant) { upcall_ = upcall; servant_ = servant; } private boolean dispatchBase() throws org.apache.yoko.orb.OB.LocationForward { String _ob_op = upcall_.operation(); // // Optimization. All operations that we dispatch start with an '_' // character. // if (_ob_op.charAt(0) != '_') return false; final String[] _ob_names = { "_interface", "_is_a", "_non_existent" }; int _ob_left = 0; int _ob_right = _ob_names.length; int _ob_index = -1; while (_ob_left < _ob_right) { int _ob_m = (_ob_left + _ob_right) / 2; int _ob_res = _ob_names[_ob_m].compareTo(_ob_op); if (_ob_res == 0) { _ob_index = _ob_m; break; } else if (_ob_res > 0) _ob_right = _ob_m; else _ob_left = _ob_m + 1; } switch (_ob_index) { case 0: // _interface { upcall_.preUnmarshal(); upcall_.postUnmarshal(); org.omg.CORBA.InterfaceDef def = servant_._get_interface(); upcall_.postinvoke(); org.apache.yoko.orb.CORBA.OutputStream out = upcall_.preMarshal(); try { out.write_Object(def); } catch (org.omg.CORBA.SystemException ex) { upcall_.marshalEx(ex); } upcall_.postMarshal(); return true; } case 1: // _is_a { org.apache.yoko.orb.CORBA.InputStream in = upcall_.preUnmarshal(); String id = null; try { id = in.read_string(); } catch (org.omg.CORBA.SystemException ex) { upcall_.unmarshalEx(ex); } upcall_.postUnmarshal(); boolean b = servant_._is_a(id); upcall_.postinvoke(); org.apache.yoko.orb.CORBA.OutputStream out = upcall_.preMarshal(); try { out.write_boolean(b); } catch (org.omg.CORBA.SystemException ex) { upcall_.marshalEx(ex); } upcall_.postMarshal(); return true; } case 2: // _non_existent { upcall_.preUnmarshal(); upcall_.postUnmarshal(); boolean b = servant_._non_existent(); upcall_.postinvoke(); org.apache.yoko.orb.CORBA.OutputStream out = upcall_.preMarshal(); try { out.write_boolean(b); } catch (org.omg.CORBA.SystemException ex) { upcall_.marshalEx(ex); } upcall_.postMarshal(); return true; } } return false; } void dispatch() throws org.apache.yoko.orb.OB.LocationForward { // // Handle common operations // if (dispatchBase()) return; // // Case 1: Servant is org.apache.yoko.orb.PortableServer.Servant, i.e., // a proprietary skeleton with full interceptor support // if (servant_ instanceof org.apache.yoko.orb.PortableServer.Servant) { org.apache.yoko.orb.PortableServer.Servant s = (org.apache.yoko.orb.PortableServer.Servant) servant_; s._OB_dispatch(upcall_); } // // Case 2: Servant is a org.omg.CORBA.portable.InvokeHandler, // i.e., a portable stream-based skeleton. For a normal reply, // the skeleton will call back to createReply(). If a user // exception occurred, the skeleton will call back to // createExceptionReply(). SystemExceptions are raised // directly. // else if (servant_ instanceof org.omg.CORBA.portable.InvokeHandler) { try { org.omg.CORBA.portable.InvokeHandler inv = (org.omg.CORBA.portable.InvokeHandler) servant_; // // Prepare to unmarshal // org.omg.CORBA.portable.InputStream in = upcall_.preUnmarshal(); // // Call postUnmarshal now. There may be interceptors that // need to be called before dispatching to the servant. // When using a portable skeleton, the interceptors cannot // obtain parameter information. // upcall_.postUnmarshal(); // // Invoke the portable skeleton // org.omg.CORBA.portable.OutputStream out = inv._invoke(upcall_ .operation(), in, this); // // The OutputStream returned by _invoke() should be // the Upcall's OutputStream // org.apache.yoko.orb.OB.Assert._OB_assert(out == upcall_ .output()); // // Finish up // if (!upcall_.userException()) upcall_.postMarshal(); } catch (Abort ex) { // // Abort is raised by createExceptionReply() // } catch (org.apache.yoko.orb.OB.RuntimeLocationForward ex) { // // RuntimeLocationForward is raised by createReply() and // createExceptionReply() to bypass the portable // skeleton and report a location-forward // throw new org.apache.yoko.orb.OB.LocationForward(ex.ior, ex.perm); } } // // Case 3: DSI // else if (servant_ instanceof org.omg.PortableServer.DynamicImplementation) { org.omg.PortableServer.DynamicImplementation impl = (org.omg.PortableServer.DynamicImplementation) servant_; org.apache.yoko.orb.CORBA.ServerRequest request = new org.apache.yoko.orb.CORBA.ServerRequest( impl, upcall_); try { impl.invoke(request); request._OB_finishUnmarshal(); request._OB_postinvoke(); request._OB_doMarshal(); } catch (org.omg.CORBA.SystemException ex) { request._OB_finishUnmarshal(); throw ex; } } else org.apache.yoko.orb.OB.Assert._OB_assert(false); } // ---------------------------------------------------------------------- // ResponseHandler standard method implementations // ---------------------------------------------------------------------- // // Called by a portable skeleton for a normal reply // public org.omg.CORBA.portable.OutputStream createReply() { try { upcall_.postinvoke(); return upcall_.preMarshal(); } catch (org.apache.yoko.orb.OB.LocationForward ex) { // // We need to raise an exception in order to abort the // current execution context and return control to // DispatchStrategy_impl. We do this by raising a // RuntimeException containing the location forward // parameters. // // Note that the user can interfere with this process // if they trap RuntimeException. // throw new org.apache.yoko.orb.OB.RuntimeLocationForward(ex.ior, ex.perm); } } // // Called by a portable skeleton for a user exception // public org.omg.CORBA.portable.OutputStream createExceptionReply() { org.omg.CORBA.portable.OutputStream out = upcall_ .beginUserException(null); // // If the return value of beginUserException is null, then // we cannot let the skeleton attempt to marshal. So we'll // raise the Abort exception to bypass the portable skeleton. // // Note that the user can interfere with this process // if they trap RuntimeException. // if (out == null) throw new Abort(); else return out; } }
6,816
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/OBPortableServer/POAManagerHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManager:1.0 // final public class POAManagerHolder implements org.omg.CORBA.portable.Streamable { public POAManager value; public POAManagerHolder() { } public POAManagerHolder(POAManager initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = POAManagerHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { POAManagerHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return POAManagerHelper.type(); } }
6,817
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/OBPortableServer/CommunicationsConcurrencyPolicyHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/CommunicationsConcurrencyPolicy:1.0 // final public class CommunicationsConcurrencyPolicyHolder implements org.omg.CORBA.portable.Streamable { public CommunicationsConcurrencyPolicy value; public CommunicationsConcurrencyPolicyHolder() { } public CommunicationsConcurrencyPolicyHolder(CommunicationsConcurrencyPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = CommunicationsConcurrencyPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { CommunicationsConcurrencyPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return CommunicationsConcurrencyPolicyHelper.type(); } }
6,818
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/OBPortableServer/POAManager_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.OBPortableServer; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.OBPortableServer.COMMUNICATIONS_CONCURRENCY_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.COMMUNICATIONS_CONCURRENCY_POLICY_REACTIVE; import org.apache.yoko.orb.OBPortableServer.COMMUNICATIONS_CONCURRENCY_POLICY_THREADED; import org.apache.yoko.orb.OBPortableServer.CommunicationsConcurrencyPolicy; import org.apache.yoko.orb.OBPortableServer.CommunicationsConcurrencyPolicyHelper; import org.apache.yoko.orb.OBPortableServer.GIOPVersionPolicy; import org.apache.yoko.orb.OBPortableServer.GIOPVersionPolicyHelper; import org.apache.yoko.orb.OBPortableServer.GIOP_VERSION_POLICY_1_0; import org.apache.yoko.orb.OBPortableServer.GIOP_VERSION_POLICY_1_1; import org.apache.yoko.orb.OBPortableServer.GIOP_VERSION_POLICY_1_2; import org.apache.yoko.orb.OBPortableServer.GIOP_VERSION_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.POAManager; import org.omg.PortableServer.POAManagerPackage.*; final public class POAManager_impl extends org.omg.CORBA.LocalObject implements POAManager { static final Logger logger = Logger.getLogger(POAManager_impl.class.getName()); // // The ORBInstance // private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // // Set of associated POAs // // // Set of connected POAs // private java.util.Hashtable poas_; // // The POAManager state // private org.omg.PortableServer.POAManagerPackage.State state_; // // The OCI acceptors // private org.apache.yoko.orb.OCI.Acceptor[] acceptors_; // // The server manager // private org.apache.yoko.orb.OB.ServerManager serverManager_; // // The POAManager id // private String id_; // // The POAManager Adapter Manager id // String adapterManagerId_; // // The OAInterface // private org.apache.yoko.orb.OB.OAInterface oaInterface_; // // The GIOP version // private org.omg.GIOP.Version version_ = new org.omg.GIOP.Version(); // // The boot manager implementation // private org.apache.yoko.orb.OB.BootManager_impl bootManagerImpl_; // // The POALocator // private POALocator poaLocator_; // // The Server Id // private String serverId_; // ------------------------------------------------------------------ // POAManager_impl private and protected member implementations // ------------------------------------------------------------------ // // If we're in the context of a method invocation returns true, // false otherwise. // private boolean isInORBUpcall() { // // Find out whether we're inside a method invocation // boolean inInvocation = false; try { org.apache.yoko.orb.OB.InitialServiceManager initialServiceManager = orbInstance_ .getInitialServiceManager(); org.omg.CORBA.Object o = initialServiceManager .resolveInitialReferences("POACurrent"); org.apache.yoko.orb.PortableServer.Current_impl current = (org.apache.yoko.orb.PortableServer.Current_impl) o; inInvocation = current._OB_inUpcall(); if (inInvocation) { // // Check whether or not the request is dispatched in this // POAManager's ORB or another ORB. // try { POA_impl p = (POA_impl) current.get_POA(); inInvocation = (p._OB_ORBInstance() == orbInstance_); } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { } } } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { } catch (ClassCastException ex) { // Cast to Current_impl failed - ignore } return inInvocation; } // // Wait for all pending requests to complete // private void waitPendingRequests() { // // Wait for all pending requests from all POAs to complete // java.util.Enumeration keys = poas_.keys(); while (keys.hasMoreElements()) { POA_impl poaImpl = (POA_impl) poas_.get(keys.nextElement()); poaImpl._OB_waitPendingRequests(); } } // // Etherealize each of the servants associated with each POA // private void etherealizePOAs() { try { org.apache.yoko.orb.OB.InitialServiceManager initialServiceManager = orbInstance_ .getInitialServiceManager(); org.omg.CORBA.Object o = initialServiceManager .resolveInitialReferences("RootPOA"); org.apache.yoko.orb.OBPortableServer.POA_impl rootPOA = (org.apache.yoko.orb.OBPortableServer.POA_impl) o; // // Etherealize recursively from the RootPOA and only POAs // associated to this POAManager. // rootPOA._OB_etherealize(this); } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { } } // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public synchronized void activate() throws AdapterInactive { logger.fine("Activating POAManager " + id_ + " current state is " + state_); // // If the POA manager is in inactive state then raise the // AdapterInactive exception // if (state_ == State.INACTIVE) { throw new AdapterInactive(); } if (state_ == State.ACTIVE) { logger.fine("POAManager already active, returning"); return; } // // Switch to the active state. // state_ = State.ACTIVE; // // Notify all of a state transition // notifyAll(); // // Activate the server manager // serverManager_.activate(); // // Tell the OAInterface to accept requests // oaInterface_.activate(); // // Call the state change interceptor // org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); piManager.adapterManagerStateChange(adapterManagerId_, _OB_getAdapterState()); } public void hold_requests(boolean waitCompletion) throws AdapterInactive { synchronized (this) { // // If the POA manager is in inactive state then raise the // AdapterInactive exception // if (state_ == State.INACTIVE) throw new AdapterInactive(); if (state_ == State.HOLDING) return; if (waitCompletion && isInORBUpcall()) { throw new org.omg.CORBA.BAD_INV_ORDER("Invocation in progress", 0, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } // // Switch to the holding state. // state_ = State.HOLDING; // // Notify all of a state transition // notifyAll(); // // Ask the server manager to hold // serverManager_.hold(); // // Tell the OAInterface to accept requests // oaInterface_.activate(); // // Call the state change interceptor // org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); piManager.adapterManagerStateChange(adapterManagerId_, _OB_getAdapterState()); } // // Wait for all pending requests to complete, if asked // if (waitCompletion) waitPendingRequests(); } public void discard_requests(boolean waitCompletion) throws AdapterInactive { synchronized (this) { // // If the POA manager is in inactive state then raise the // AdapterInactive exception // if (state_ == State.INACTIVE) throw new AdapterInactive(); if (state_ == State.DISCARDING) return; if (waitCompletion && isInORBUpcall()) { throw new org.omg.CORBA.BAD_INV_ORDER("Invocation in progress", 0, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } // // Switch to the discarding state. // state_ = State.DISCARDING; // // Notify all of a state transition // notifyAll(); // // Tell the OAInterface to discard requests // oaInterface_.discard(); // // Activate the server manager // serverManager_.activate(); // // Call the state change interceptor // org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); piManager.adapterManagerStateChange(adapterManagerId_, _OB_getAdapterState()); } // // Wait for all pending requests to complete, if asked // if (waitCompletion) waitPendingRequests(); } public void deactivate(boolean etherealize, boolean waitCompletion) throws AdapterInactive { synchronized (this) { if (state_ == State.INACTIVE) return; if (waitCompletion && isInORBUpcall()) { throw new org.omg.CORBA.BAD_INV_ORDER("Invocation in progress", 0, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } // // Destroy the server manager // serverManager_.destroy(); // // Clear the acceptor sequence // acceptors_ = null; // // Set the state to INACTIVE *after* the serverManager_ has // been destroyed, to avoid a race condition. // state_ = State.INACTIVE; // // Notify all of a state transition // notifyAll(); // // Call the state change interceptor // org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); piManager.adapterManagerStateChange(adapterManagerId_, _OB_getAdapterState()); } // // Wait for all pending requests to complete, if asked // if (waitCompletion) waitPendingRequests(); // // Etherealize each of the servants associated with each POA // if (etherealize) { etherealizePOAs(); } } // // We'll remove the synchronization at present since this is a // simple state variable // public/* synchronized */State get_state() { return state_; } // // Mapping for OBPortableServer::POAManager // public String get_id() { return id_; } public synchronized org.apache.yoko.orb.OCI.Acceptor[] get_acceptors() throws AdapterInactive { if (state_ == State.INACTIVE) throw new AdapterInactive(); org.apache.yoko.orb.OCI.Acceptor[] result = new org.apache.yoko.orb.OCI.Acceptor[acceptors_.length]; System.arraycopy(acceptors_, 0, result, 0, acceptors_.length); return result; } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ POAManager_impl(org.apache.yoko.orb.OB.ORBInstance orbInstance, POALocator poaLocator, String id, String adapterManagerId, org.apache.yoko.orb.OCI.Acceptor[] acceptors, org.omg.CORBA.Policy[] policies) throws org.omg.CORBA.PolicyError { orbInstance_ = orbInstance; poas_ = new java.util.Hashtable(63); state_ = State.HOLDING; acceptors_ = acceptors; id_ = id; adapterManagerId_ = adapterManagerId; poaLocator_ = poaLocator; // // Set the server id // serverId_ = orbInstance_.getServerId(); if (serverId_.length() == 0) serverId_ = "_RootPOA"; // // Create the OAInterface // oaInterface_ = new POAOAInterface_impl(this, orbInstance_); // // Construct the root name of the property key for this POAManager // instance // String rootKey = "yoko.orb.poamanager." + id_ + "."; int rootKeyLen = rootKey.length(); // // Get the ORB properties // java.util.Properties properties = orbInstance.getProperties(); // // The set of properties that the POAManager supports // final String props[] = { "conc_model", "endpoint", "version" }; int numProps = props.length; // // If policies are provided, they will take precedence // over the configuration properties. // CommunicationsConcurrencyPolicy commsPolicy = null; GIOPVersionPolicy giopPolicy = null; int nPolicies = policies.length; if (nPolicies != 0) { for (int i = 0; i < nPolicies; ++i) { int policyType = policies[i].policy_type(); if (policyType == COMMUNICATIONS_CONCURRENCY_POLICY_ID.value) { commsPolicy = CommunicationsConcurrencyPolicyHelper .narrow(policies[i]); } else if (policyType == GIOP_VERSION_POLICY_ID.value) { giopPolicy = GIOPVersionPolicyHelper.narrow(policies[i]); } else { throw new org.omg.CORBA.PolicyError( org.omg.CORBA.BAD_POLICY_TYPE.value); } } } // // Check over the POAManager properties and find out whether an // unknown property is present // java.util.Enumeration keys = properties.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); // // Ignore yoko.orb.oa.thread_pool // if (key.equals("yoko.orb.oa.thread_pool")) continue; // // Remove the property prefix // String prop; if (key.startsWith(rootKey)) prop = key.substring(rootKeyLen); else if (key.startsWith("yoko.orb.oa.")) prop = key.substring("yoko.orb.oa.".length()); else continue; // // Check for a match among the supported properties // int i; for (i = 0; i < numProps; i++) if (prop.equals(props[i])) break; // // Was the property present? // if (i >= numProps) { String err = key + ": unknown property"; logger.warning(err); } } // // Configuration parameters // version_.major = (byte) 1; version_.minor = (byte) 2; int concModel = org.apache.yoko.orb.OB.Server.Threaded; // // Check for comms policy: // boolean commsPolicyPresent; if (commsPolicy == null) { commsPolicyPresent = false; } else { commsPolicyPresent = true; short value = commsPolicy.value(); if (value == COMMUNICATIONS_CONCURRENCY_POLICY_REACTIVE.value) { concModel = org.apache.yoko.orb.OB.Server.Blocking; } else if (value == COMMUNICATIONS_CONCURRENCY_POLICY_THREADED.value) { concModel = org.apache.yoko.orb.OB.Server.Threaded; } else { throw new org.omg.CORBA.PolicyError( org.omg.CORBA.BAD_POLICY_VALUE.value); } } // // Check for giop policy: // boolean giopPolicyPresent; if (giopPolicy == null) { giopPolicyPresent = false; } else { giopPolicyPresent = true; short value = giopPolicy.value(); if (value == GIOP_VERSION_POLICY_1_0.value) { version_.major = (byte) 1; version_.minor = (byte) 0; } else if (value == GIOP_VERSION_POLICY_1_1.value) { version_.major = (byte) 1; version_.minor = (byte) 1; } else if (value == GIOP_VERSION_POLICY_1_2.value) { version_.major = (byte) 1; version_.minor = (byte) 2; } else { throw new org.omg.CORBA.PolicyError( org.omg.CORBA.BAD_POLICY_VALUE.value); } } // // Parse the individual properties, if necessary. // This is necessary as long as not all of the policies have // been specified. // if (!commsPolicyPresent || !giopPolicyPresent) { for (int i = 0; i < numProps; i++) { String key = props[i]; // // First check the specific POAManager key // String fullkey = rootKey + key; String value = properties.getProperty(fullkey); // // If the specific POAManager key doesn't have a value then // check the default value "yoko.orb.oa.*" // if (value == null) { fullkey = "yoko.orb.oa." + key; value = properties.getProperty(fullkey); } // // No value // if (value == null) continue; if (key.equals("conc_model") && !commsPolicyPresent) { if (value.equals("threaded")) concModel = org.apache.yoko.orb.OB.Server.Threaded; // // Technically the only valid values for // yoko.orb.poamanager.*.conc_model are "reactive" and // "threaded" since this is the communications conc model. // However, we'll also accept the following values since // we might be parsing "yoko.orb.oa.conc_model" (which // represents the default value for both the comm conc // model *and* the method dispatch model). // else if (value.equals("thread_per_client")) concModel = org.apache.yoko.orb.OB.Server.Threaded; else if (value.equals("thread_per_request")) concModel = org.apache.yoko.orb.OB.Server.Threaded; else if (value.equals("thread_pool")) concModel = org.apache.yoko.orb.OB.Server.Threaded; else { String err = fullkey + ": unknown value"; logger.warning(err); } } else if (key.equals("version") && !giopPolicyPresent) { if (value.equals("1.0")) { version_.major = (byte) 1; version_.minor = (byte) 0; } else if (value.equals("1.1")) { version_.major = (byte) 1; version_.minor = (byte) 1; } else if (value.equals("1.2")) { version_.major = (byte) 1; version_.minor = (byte) 2; } else { String err = fullkey + ": expected `1.0', `1.1' or `1.2'"; logger.severe(err); throw new org.omg.CORBA.INITIALIZE(err); } } } } // // Create the server manager // serverManager_ = new org.apache.yoko.orb.OB.ServerManager(orbInstance_, acceptors_, oaInterface_, concModel); // // Get the boot manager implementation // bootManagerImpl_ = (org.apache.yoko.orb.OB.BootManager_impl) orbInstance .getBootManager(); } // // Register a POA with this POAManager // synchronized void _OB_addPOA(org.omg.PortableServer.POA poa, String[] id) { POANameHasher idkey = new POANameHasher(id); logger.fine("Adding new poa with id " + idkey); org.apache.yoko.orb.OB.Assert._OB_assert(!poas_.containsKey(idkey)); poas_.put(idkey, poa); poaLocator_.add(poa, id); } // // Un-register a POA with this POAManager // synchronized void _OB_removePOA(String[] id) { POANameHasher idkey = new POANameHasher(id); logger.fine("Removing poa with id " + idkey); org.apache.yoko.orb.OB.Assert._OB_assert(poas_.containsKey(idkey)); poas_.remove(idkey); poaLocator_.remove(id); } DirectServant _OB_getDirectServant(byte[] key, org.apache.yoko.orb.OB.RefCountPolicyList policies) throws org.apache.yoko.orb.OB.LocationForward, AdapterInactive { synchronized (this) { if (state_ == State.INACTIVE) throw new AdapterInactive(); } org.apache.yoko.orb.OB.ObjectKeyData data = new org.apache.yoko.orb.OB.ObjectKeyData(); if (org.apache.yoko.orb.OB.ObjectKey.ParseObjectKey(key, data)) { org.omg.PortableServer.POA poa; synchronized (this) { poa = _OB_locatePOA(data); } if (poa != null) { POA_impl poaImpl = (POA_impl) poa; return poaImpl._OB_getDirectServant(data.oid, policies); } } // // Check to see if the BootManager knows of a reference // for the ObjectKey. If so, forward the request. // synchronized (this) { org.omg.IOP.IOR ior = bootManagerImpl_._OB_locate(key); if (ior != null) throw new org.apache.yoko.orb.OB.LocationForward(ior, false); } // // In this case, there is no POA for a local servant. This is // an OBJECT_NOT_EXIST exception. // throw new org.omg.CORBA.OBJECT_NOT_EXIST("No POA for local servant"); } org.omg.PortableServer.POA _OB_locatePOA( org.apache.yoko.orb.OB.ObjectKeyData data) throws org.apache.yoko.orb.OB.LocationForward { // // If the GIOP engine sends a request while the POAManager is in // INACTIVE state, then something is wrong. // org.apache.yoko.orb.OB.Assert._OB_assert(get_state() != State.INACTIVE); logger.fine("Searching for direct servant with key " + data); org.omg.PortableServer.POA poa = null; if (data.serverId.equals(serverId_)) { POANameHasher key = new POANameHasher(data.poaId); logger.fine("Searching for direct servant with poa key " + key); poa = (org.omg.PortableServer.POA) poas_.get(key); if (poa == null) { // // The POA isn't contained in our local POA table. Ask the // POALocator to locate the POA. // poa = poaLocator_.locate(data); // // If the POA is connected to some other POAManager (and // hence some other end-point) then location forward // if (poa != null) { logger.fine("Attempting to obtain a local reference to an object activated on a differnt POA"); org.omg.PortableServer.POAManager manager = poa.the_POAManager(); if (manager != this) { Object obj = poa.create_reference_with_id(data.oid, ""); org.apache.yoko.orb.CORBA.Delegate p = (org.apache.yoko.orb.CORBA.Delegate) (((org.omg.CORBA.portable.ObjectImpl) obj) ._get_delegate()); org.omg.IOP.IOR ior = p._OB_IOR(); throw new org.apache.yoko.orb.OB.LocationForward(ior, false); } } } } // // If the POA doesn't match the ObjectKeyData then this POA // isn't present. // if (poa != null) { POA_impl poaImpl = (POA_impl) poa; if (!poaImpl._OB_poaMatches(data, false)) { logger.fine("POA located but object key data doesn't match"); poa = null; } } return poa; } public org.apache.yoko.orb.OB.CollocatedServer _OB_getCollocatedServer() { return serverManager_.getCollocatedServer(); } public synchronized void _OB_validateState() { while (true) { // // If POAManager::activate() has been called then we're done // if (state_ == State.ACTIVE) break; // // If the POAManager is INACTIVE or DISCARDING then throw a // TRANSIENT exception // if (state_ == State.INACTIVE || state_ == State.DISCARDING) throw new org.omg.CORBA.TRANSIENT( "POAManager is inactive or discarding requests", 0, org.omg.CORBA.CompletionStatus.COMPLETED_NO); // // Wait for a state transition // try { wait(); } catch (InterruptedException ex) { } } } public org.omg.GIOP.Version _OB_getGIOPVersion() { return new org.omg.GIOP.Version(version_.major, version_.minor); } public String _OB_getAdapterManagerId() { return adapterManagerId_; } public short _OB_getAdapterState() { // // We'll remove the synchronization at present since this is a // simple state variable // switch (state_.value()) { case State._INACTIVE: return org.omg.PortableInterceptor.INACTIVE.value; case State._ACTIVE: return org.omg.PortableInterceptor.ACTIVE.value; case State._HOLDING: return org.omg.PortableInterceptor.HOLDING.value; case State._DISCARDING: return org.omg.PortableInterceptor.DISCARDING.value; } org.apache.yoko.orb.OB.Assert._OB_assert(false); return org.omg.PortableInterceptor.NON_EXISTENT.value; } public org.apache.yoko.orb.OCI.Acceptor[] _OB_getAcceptors() { org.apache.yoko.orb.OCI.Acceptor[] result = new org.apache.yoko.orb.OCI.Acceptor[acceptors_.length]; System.arraycopy(acceptors_, 0, result, 0, acceptors_.length); return result; } public org.apache.yoko.orb.OB.ServerManager _OB_getServerManager() { return serverManager_; } public org.apache.yoko.orb.OB.OAInterface _OB_getOAInterface() { return oaInterface_; } }
6,819
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/OBPortableServer/SynchronizationPolicyHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicy:1.0 // final public class SynchronizationPolicyHolder implements org.omg.CORBA.portable.Streamable { public SynchronizationPolicy value; public SynchronizationPolicyHolder() { } public SynchronizationPolicyHolder(SynchronizationPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = SynchronizationPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { SynchronizationPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return SynchronizationPolicyHelper.type(); } }
6,820
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/OBPortableServer/CommunicationsConcurrencyPolicyOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/CommunicationsConcurrencyPolicy:1.0 // /** * * Communications Concurrency Policy * **/ public interface CommunicationsConcurrencyPolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/CommunicationsConcurrencyPolicy/value:1.0 // /***/ short value(); }
6,821
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/OBPortableServer/POAManagerFactory_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.OBPortableServer; import org.apache.yoko.orb.OBPortableServer.AcceptorConfig; import org.apache.yoko.orb.OBPortableServer.CommunicationsConcurrencyPolicy; import org.apache.yoko.orb.OBPortableServer.ENDPOINT_CONFIGURATION_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.EndpointConfigurationPolicy; import org.apache.yoko.orb.OBPortableServer.EndpointConfigurationPolicyHelper; import org.apache.yoko.orb.OBPortableServer.GIOPVersionPolicy; import org.apache.yoko.orb.OBPortableServer.POAManager; import org.apache.yoko.orb.OBPortableServer.POAManagerFactory; final public class POAManagerFactory_impl extends org.omg.CORBA.LocalObject implements POAManagerFactory { // // The ORB Instance // private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // // Hashtable mapping name -> POAManager // private java.util.Hashtable managers_ = new java.util.Hashtable(); // // Running count for generating unique names // private int count_ = 0; // // The IMRActiveStateHolder // private org.apache.yoko.orb.IMR.ActiveState activeState_; // // The POALocator // private POALocator poaLocator_; // // The OAD::ProcessEndpoint // private org.apache.yoko.orb.OAD.ProcessEndpoint_impl processEndpoint_; // // This has to be a member of the ORB since we need to keep the // connection open for the lifespan of the process. // // TODO: When we have connection reaping then we'll have to have // to set a policy on this object to prevent the connection from // being reaped. // private org.omg.CORBA.Object endpointManager_; private String getUniqueName() { long now = System.currentTimeMillis(); String name = "POAManager-" + now; name += count_++; org.apache.yoko.orb.OB.Assert._OB_assert(!managers_.containsKey(name)); return name; } private void validateName(String name) throws org.omg.PortableServer.POAManagerFactoryPackage.ManagerAlreadyExists { // // Does the POAManager exist? // POAManager manager = (POAManager) managers_.get(name); if (manager != null) { // // If the POAManager is INACTIVE then remove it from // the list, and allow the user to re-add the // POAManager // if (manager.get_state() == org.omg.PortableServer.POAManagerPackage.State.INACTIVE) managers_.remove(name); else throw new org.omg.PortableServer.POAManagerFactoryPackage.ManagerAlreadyExists(); } } private AcceptorConfig[] parseEndpointString(String endpoint) { org.apache.yoko.orb.OB.Logger logger = orbInstance_.getLogger(); java.util.Vector configVec = new java.util.Vector(); org.apache.yoko.orb.OCI.AccFactoryRegistry registry = orbInstance_ .getAccFactoryRegistry(); org.apache.yoko.orb.OCI.AccFactory[] factories = registry .get_factories(); int pos = 0; while (pos != -1) { java.util.Vector params = new java.util.Vector(); pos = org.apache.yoko.orb.OB.ParseParams.parse(endpoint, pos, params); if (!params.isEmpty()) { String prot = (String) params.firstElement(); params.removeElementAt(0); boolean found = false; int i; for (i = 0; i < factories.length; i++) { if (prot.equals(factories[i].id())) { String[] paramSeq = new String[params.size()]; params.copyInto(paramSeq); AcceptorConfig config = new AcceptorConfig(prot, paramSeq); configVec.addElement(config); found = true; break; } } if (!found) { String err = "unknown endpoint protocol `" + prot + "'"; logger.error(err); throw new org.omg.CORBA.INITIALIZE(err); } } } if (configVec.size() == 0) { String err = "no endpoints defined"; logger.error(err); throw new org.omg.CORBA.INITIALIZE(err); } AcceptorConfig[] configArr = new org.apache.yoko.orb.OBPortableServer.AcceptorConfig[configVec .size()]; configVec.copyInto(configArr); return configArr; } // ---------------------------------------------------------------------- // OBPOAManagerFactory_impl public member implementation // ---------------------------------------------------------------------- public POAManagerFactory_impl() { managers_ = new java.util.Hashtable(7); poaLocator_ = new POALocator(); } // ---------------------------------------------------------------------- // Standard IDL to Java mapping // ---------------------------------------------------------------------- public org.omg.PortableServer.POAManager create_POAManager(String id, org.omg.CORBA.Policy[] policies) throws org.omg.PortableServer.POAManagerFactoryPackage.ManagerAlreadyExists, org.omg.CORBA.PolicyError { synchronized (managers_) { if (id.length() == 0) { id = getUniqueName(); } else { validateName(id); ++count_; } java.util.Properties props = orbInstance_.getProperties(); org.apache.yoko.orb.OB.Logger logger = orbInstance_.getLogger(); // // If no endpoint config policy is defined, this info will // have to be retrieved from the orb properties. // EndpointConfigurationPolicy endpointPolicy = null; // // We are only concerned with the endpoint config policy // here; other policies will be passed on to the POAManager_impl // constructor. // java.util.Vector tmpPolicyVector = new java.util.Vector(); int nTmpPolicies = 0; int nPolicies = policies.length; if (nPolicies != 0) { for (int i = 0; i < nPolicies; ++i) { int policyType = policies[i].policy_type(); if (policyType == ENDPOINT_CONFIGURATION_POLICY_ID.value) { endpointPolicy = EndpointConfigurationPolicyHelper .narrow(policies[i]); } else { ++nTmpPolicies; tmpPolicyVector.addElement(policies[i]); } } } org.omg.CORBA.Policy[] tmpPolicies = new org.omg.CORBA.Policy[tmpPolicyVector .size()]; tmpPolicyVector.copyInto(tmpPolicies); AcceptorConfig[] config; if (endpointPolicy == null) { // // Get the endpoint configuration // String rootStr = null; String paramStr = null; if (id.equals("RootPOAManager")) rootStr = props.getProperty("yoko.orb.oa.endpoint"); String propName = "yoko.orb.poamanager." + id + ".endpoint"; paramStr = props.getProperty(propName); if (paramStr == null && rootStr == null) paramStr = "iiop"; else if (paramStr == null) paramStr = rootStr; config = parseEndpointString(paramStr); } else { // // Create acceptors based on the endpoint config policy // config = endpointPolicy.value(); } org.apache.yoko.orb.OCI.AccFactoryRegistry registry = orbInstance_ .getAccFactoryRegistry(); java.util.Vector acceptors = new java.util.Vector(); int nConfig = config.length; for (int i = 0; i < nConfig; i++) { try { org.apache.yoko.orb.OCI.AccFactory factory = registry .get_factory(config[i].id); acceptors.addElement(factory .create_acceptor(config[i].params)); } catch (org.apache.yoko.orb.OCI.NoSuchFactory ex) { String err = "cannot find factory: " + ex; logger.error(err, ex); throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE(err).initCause(ex); } catch (org.apache.yoko.orb.OCI.InvalidParam ex) { String err = "unable to create acceptor: " + ex.reason; logger.error(err, ex); throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE(err).initCause(ex); } } // // Create the new POAManager_impl and add to the table // org.apache.yoko.orb.OCI.Acceptor[] arr = new org.apache.yoko.orb.OCI.Acceptor[acceptors .size()]; acceptors.copyInto(arr); POAManager manager = new POAManager_impl(orbInstance_, poaLocator_, id, Integer.toString(count_), arr, tmpPolicies); managers_.put(id, manager); return manager; } } public org.omg.PortableServer.POAManager[] list() { java.util.Enumeration e = managers_.keys(); java.util.Vector result = new java.util.Vector(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); POAManager manager = (org.apache.yoko.orb.OBPortableServer.POAManager) managers_ .get(name); if (manager != null) result.addElement(manager); } POAManager[] r = new POAManager[result.size()]; result.copyInto(r); return r; } public org.omg.PortableServer.POAManager find(String id) { return (org.omg.PortableServer.POAManager) (managers_.get(id)); } public void destroy() { // // Remove the references to the orbInstance_ // orbInstance_ = null; // // Shutdown, if necessary // if (!managers_.isEmpty()) _OB_deactivate(); } public EndpointConfigurationPolicy create_endpoint_configuration_policy( String value) throws org.omg.CORBA.PolicyError { AcceptorConfig[] configArray = parseEndpointString(value); return new EndpointConfigurationPolicy_impl(configArray); } public CommunicationsConcurrencyPolicy create_communications_concurrency_policy( short value) throws org.omg.CORBA.PolicyError { return new CommunicationsConcurrencyPolicy_impl(value); } public GIOPVersionPolicy create_giop_version_policy(short value) throws org.omg.CORBA.PolicyError { return new GIOPVersionPolicy_impl(value); } // // Deactivate all POAManagers // public void _OB_deactivate() { // // Deactivate each of the POAManagers // java.util.Enumeration e = managers_.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); POAManager manager = (POAManager) managers_.get(name); if (manager != null) { try { manager.deactivate(true, true); } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ex) { // Ignore } } } managers_.clear(); // // Tell the IMR that the ORB is STOPPING // if (activeState_ != null) { org.apache.yoko.orb.OB.Logger logger = orbInstance_.getLogger(); String serverInstance = orbInstance_.getServerInstance(); try { activeState_.set_status(serverInstance, org.apache.yoko.orb.IMR.ServerStatus.STOPPING); } catch (org.omg.CORBA.SystemException ex) { String msg = orbInstance_.getServerId() + ": Cannot contact IMR on shutdown"; logger.warning(msg, ex); } // // Clear the IMR::Server record // activeState_ = null; } } public DirectServant _OB_getDirectServant(org.omg.IOP.IOR ior, org.apache.yoko.orb.OB.RefCountPolicyList policies) throws org.apache.yoko.orb.OB.LocationForward { // // Optimization // if (managers_.isEmpty()) return null; java.util.Enumeration e = managers_.keys(); while (e.hasMoreElements()) { try { String name = (String) e.nextElement(); POAManager_impl manager = (POAManager_impl) managers_.get(name); if (manager != null) { org.apache.yoko.orb.OCI.Acceptor[] acceptors = manager .get_acceptors(); for (int i = 0; i < acceptors.length; i++) { org.apache.yoko.orb.OCI.ProfileInfo[] profileInfos = acceptors[i] .get_local_profiles(ior); // // If the IOR is local then at least one ProfileInfo // will be returned // if (profileInfos.length > 0) { // // In the case that the servant cannot support a // direct invocation, null will be returned // return manager._OB_getDirectServant( profileInfos[0].key, policies); } } } } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ex) { // // Ignore -- the POAManager isn't valid anymore // } catch (org.omg.CORBA.OBJECT_NOT_EXIST ex) { // also ignored. At this point, we just want to determine if there is a local version. } } return null; } public void _OB_setORBInstance(org.apache.yoko.orb.OB.ORBInstance instance) { orbInstance_ = instance; } public void _OB_initializeIMR(POA_impl root, org.apache.yoko.orb.OB.ORBControl orbControl) { String serverId = orbInstance_.getServerId(); String serverInstance = orbInstance_.getServerInstance(); java.util.Properties properties = orbInstance_.getProperties(); String noIMR = properties.getProperty("yoko.orb.noIMR"); if (serverId.length() == 0 || noIMR != null) return; // // Create the OAD::ProcessMonitor servant // processEndpoint_ = new org.apache.yoko.orb.OAD.ProcessEndpoint_impl( serverId, serverInstance, root, orbControl); org.apache.yoko.orb.IMR.Domain imrDomain = null; try { org.apache.yoko.orb.OB.InitialServiceManager initServiceManager = orbInstance_ .getInitialServiceManager(); org.omg.CORBA.Object imrObj = initServiceManager .resolveInitialReferences("IMR"); imrDomain = org.apache.yoko.orb.IMR.DomainHelper.narrow(imrObj); } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { // Ignore -- this will be handled later } catch (org.omg.CORBA.BAD_PARAM ex) { // narrow() failed } org.apache.yoko.orb.OB.Logger logger = orbInstance_.getLogger(); // // IMR::IMRDomain not reachable? // if (imrDomain == null) { String msg = serverId + ": IMRDomain not reachable"; logger.error(msg); throw new org.omg.CORBA.INITIALIZE(msg); } // // Check if need to register with the IMR // String exec = properties.getProperty("yoko.orb.imr.register"); if (exec != null) { // // TODO: What do we do for Java? // String msg = serverId + ": Self registration not implemented" + " for java servers"; logger.error(msg); throw new org.omg.CORBA.INITIALIZE(msg); } // // Tell the IMR that we're starting up // try { // // This is the ProcessEndpointManager // org.apache.yoko.orb.OAD.ProcessEndpointManagerHolder endpoint = new org.apache.yoko.orb.OAD.ProcessEndpointManagerHolder(); org.omg.PortableInterceptor.ObjectReferenceTemplate primary = root .adapter_template(); // // Tell the IMR that we are STARTING. // activeState_ = imrDomain.startup(serverId, serverInstance, primary, endpoint); // // Link with the OAD ProcessEndpoint // org.apache.yoko.orb.OAD.ProcessEndpoint ref = processEndpoint_ ._this(orbInstance_.getORB()); endpoint.value.establish_link(serverId, serverInstance, 0xFFFFFFFF, ref); endpointManager_ = endpoint.value; // // Create an register the IORInterceptor for the IMR // org.omg.PortableInterceptor.IORInterceptor i = new org.apache.yoko.orb.PortableInterceptor.IMRIORInterceptor_impl( logger, activeState_, serverInstance); org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); try { piManager.addIORInterceptor(i, true); } catch (org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } } catch (org.omg.CORBA.BAD_PARAM ex) { String msg = serverId + ": (IMR) Server already running"; logger.error(msg, ex); throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE(msg).initCause(ex); } catch (org.apache.yoko.orb.IMR.NoSuchServer ex) { String msg = serverId + ": (IMR) Not registered with IMR"; logger.error(msg, ex); throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE(msg).initCause(ex); } catch (org.apache.yoko.orb.IMR.NoSuchOAD ex) { String msg = serverId + ": (IMR) No OAD for host"; logger.error(msg, ex); throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE(msg).initCause(ex); } catch (org.apache.yoko.orb.IMR.OADNotRunning ex) { String msg = serverId + ": (IMR) OAD not running"; logger.error(msg, ex); throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE(msg).initCause(ex); } catch (org.apache.yoko.orb.OAD.AlreadyLinked ex) { String msg = serverId + ": (IMR) Process registered with OAD"; logger.error(msg, ex); throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE(msg).initCause(ex); } } }
6,822
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/OBPortableServer/POAManager.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManager:1.0 // /** * * This interface is a proprietary extension to the standard POAManager. * * @see PortableServer::POAManager * **/ public interface POAManager extends POAManagerOperations, org.omg.PortableServer.POAManager { }
6,823
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/OBPortableServer/GIOPVersionPolicy_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.OBPortableServer; import org.apache.yoko.orb.OBPortableServer.GIOPVersionPolicy; import org.apache.yoko.orb.OBPortableServer.GIOP_VERSION_POLICY_ID; public final class GIOPVersionPolicy_impl extends org.omg.CORBA.LocalObject implements GIOPVersionPolicy { private short value_; public GIOPVersionPolicy_impl(short value) { value_ = value; } public short value() { return value_; } public int policy_type() { return GIOP_VERSION_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,824
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/OBPortableServer/RetainStrategy.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.OBPortableServer; // // Strategy for RETAIN and USE_SERVANT_MANAGER or USE_DEFAULT_SERVANT // class RetainStrategy extends ActiveObjectOnlyStrategy { private ServantActivatorStrategy servantManager_; private DefaultServantHolder defaultServant_; private void etherealize(org.apache.yoko.orb.OB.ObjectIdHasher oid, org.omg.PortableServer.POA poa, org.omg.PortableServer.Servant servant, boolean cleanup) { // // If we have an ActivationStrategy then we have to // etherealize the object // if (servantManager_ != null) { boolean remaining = false; // // Synchronize on the servant activator now to calculate the // remaing activation flag. If we don't synchronize here // another thread might deactivate another object associated // to the same servant and we might compute an incosistent // value for the remaining activatation flag. // synchronized (servantManager_) { if (servantIdTable_ == null) { // // TODO: optimize! If servant is still in the // active object map, then we still have remaining // activations. // java.util.Enumeration keys = activeObjectTable_.keys(); while (keys.hasMoreElements()) { TableEntry entry; synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(keys .nextElement()); } if (entry == null) continue; synchronized (entry) { if (entry.state() != TableEntry.DEACTIVATED && entry.state() != TableEntry.ACTIVATE_PENDING) { if (entry.getServant() == servant) { remaining = true; break; } } } } } } servantManager_.etherealize(oid.getObjectId(), poa, servant, cleanup, remaining); } } protected void cleanupEntry(org.apache.yoko.orb.OB.ObjectIdHasher oid, TableEntry entry) { // // Cleanup the active object map and mark the // entry as deactivated. // synchronized (activeObjectTable_) { activeObjectTable_.remove(oid); } synchronized (entry) { entry.setDeactivated(); } } protected void completeDeactivate(org.omg.PortableServer.POA poa, org.apache.yoko.orb.OB.ObjectIdHasher oid, TableEntry entry) { org.omg.PortableServer.Servant servant = entry.getServant(); super.completeDeactivate(poa, oid, entry); etherealize(oid, poa, servant, false); } RetainStrategy(org.apache.yoko.orb.OBPortableServer.POAPolicies policies, org.apache.yoko.orb.OB.ORBInstance orbInstance, ServantActivatorStrategy servantManager, DefaultServantHolder defaultServant) { super(policies, orbInstance); servantManager_ = servantManager; defaultServant_ = defaultServant; } public void destroy(org.omg.PortableServer.POA poa, boolean e) { if (servantManager_ != null && e) { java.util.Enumeration keys = activeObjectTable_.keys(); while (keys.hasMoreElements()) { org.omg.PortableServer.Servant servant = null; TableEntry entry = null; org.apache.yoko.orb.OB.ObjectIdHasher key = (org.apache.yoko.orb.OB.ObjectIdHasher) keys .nextElement(); while (true) { synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(key); } if (entry == null) break; synchronized (entry) { switch (entry.state()) { case TableEntry.ACTIVE: entry.setDeactivatePending(); servant = entry.getServant(); if (servant != null) { super.completeDeactivate(poa, key, entry); // // Etherealize the servant // etherealize(key, poa, servant, true); // // Remove the entry from the active object map // synchronized (activeObjectTable_) { activeObjectTable_.remove(key); } } break; case TableEntry.DEACTIVATE_PENDING: case TableEntry.ACTIVATE_PENDING: entry.waitForStateChange(); continue; case TableEntry.DEACTIVATED: // Nothing to do break; } } break; } } } super.destroy(poa, e); if (servantManager_ != null) servantManager_.destroy(); if (defaultServant_ != null) defaultServant_.destroy(); } public void etherealize(org.omg.PortableServer.POA poa) { destroy(poa, true); } public byte[] servantToId(org.omg.PortableServer.Servant servant, org.apache.yoko.orb.PortableServer.Current_impl poaCurrent) { byte[] oid = super.servantToId(servant, poaCurrent); if (oid == null && defaultServant_ != null) return defaultServant_.servantToId(servant, poaCurrent); return oid; } public org.omg.PortableServer.Servant idToServant(byte[] oid, boolean useDefaultServant) { org.omg.PortableServer.Servant servant = super.idToServant(oid, useDefaultServant); if (servant == null && useDefaultServant && defaultServant_ != null) servant = defaultServant_.getDefaultServant(); return servant; } public org.omg.PortableServer.Servant locate(byte[] rawoid, org.omg.PortableServer.POA poa, String op, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) throws org.apache.yoko.orb.OB.LocationForward { org.apache.yoko.orb.OB.ObjectIdHasher oid = new org.apache.yoko.orb.OB.ObjectIdHasher( rawoid); while (true) { boolean incarnate = false; TableEntry entry; synchronized (activeObjectTable_) { entry = (TableEntry) activeObjectTable_.get(oid); if (entry == null) { if (defaultServant_ != null) { org.omg.PortableServer.Servant servant = defaultServant_ .getDefaultServant(); if (servant == null) { throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorNoDefaultServant), org.apache.yoko.orb.OB.MinorCodes.MinorNoDefaultServant, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } return servant; } // // Insert the servant entry in the active object table // with the provided id. // entry = new TableEntry(); activeObjectTable_.put(oid, entry); incarnate = true; } } org.omg.PortableServer.Servant servant = null; if (incarnate) { try { servant = servantManager_.incarnate(oid.getObjectId(), poa); // // 11-25: // // "If the incarnate operation returns a servant // that is already active for a different Object // Id and if the POA also has the UNIQUE_ID // policy, the incarnate has violated the POA // policy and is considered to be in error. The // POA will raise an OBJ_ADAPTER system exception // for the request." // // Note: The activator should be allowed to // explicitly activate the servant for the given // ObjectId. // if (servantIdTable_ != null && // TODO: initialize anyway? servantIdTable_.containsKey(servant)) { byte[] oid2 = (byte[]) servantIdTable_.get(servant); if (!org.apache.yoko.orb.OB.ObjectIdHasher.comp(rawoid, oid2)) throw new org.omg.CORBA.OBJ_ADAPTER( "ServantActivator returned a servant that " + "is already active for a different object ID"); } } catch (org.apache.yoko.orb.OB.LocationForward l) { cleanupEntry(oid, entry); throw l; } catch (org.omg.CORBA.SystemException e) { cleanupEntry(oid, entry); throw e; } } synchronized (entry) { switch (entry.state()) { case TableEntry.ACTIVATE_PENDING: if (incarnate) { completeActivation(oid, servant, entry); return servant; } else { entry.waitForStateChange(); continue; } case TableEntry.DEACTIVATE_PENDING: { entry.waitForStateChange(); continue; } case TableEntry.ACTIVE: { // // The incarnate() call might have explicitely // register the servant, check that the registered // servant is the same as the incarnated servant. // org.omg.PortableServer.Servant s = entry.getServant(); if (incarnate) { if (s != servant) { throw new org.omg.CORBA.OBJ_ADAPTER( "ServantActivator returned a servant that " + "does not match the active object map"); } return servant; } return s; } case TableEntry.DEACTIVATED: break; } } } } public ServantManagerStrategy getServantManagerStrategy() { return servantManager_; } public DefaultServantHolder getDefaultServantHolder() { return defaultServant_; } }
6,825
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/OBPortableServer/POALocator.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.OBPortableServer; import java.util.logging.Level; import java.util.logging.Logger; final class POALocator { static final Logger logger = Logger.getLogger(POALocator.class.getName()); java.util.Hashtable poas_ = new java.util.Hashtable(63); // // Locate a POA // synchronized org.omg.PortableServer.POA locate( org.apache.yoko.orb.OB.ObjectKeyData data) throws org.apache.yoko.orb.OB.LocationForward { logger.fine("Searching for POA " + data); // // If length of poa name sequence is zero we are looking // for a root POA and are doomed to fail. // if (data.poaId.length == 0) { return null; } org.omg.PortableServer.POA poa = (org.omg.PortableServer.POA) poas_.get(new POANameHasher(data.poaId)); if (poa == null) { logger.fine("POA not found by direct lookup, searching the hierarchy"); // // Arrange for POA activation. The algorithm for this is // to find the first POA in the `path' that exists. We // then call find_POA on each remaining POA in the path to // cause the activation. // String[] poaId = new String[data.poaId.length]; System.arraycopy(data.poaId, 0, poaId, 0, data.poaId.length); java.util.Vector remaining = new java.util.Vector(); do { remaining.addElement(poaId[poaId.length - 1]); String[] newID = new String[poaId.length - 1]; System.arraycopy(poaId, 0, newID, 0, poaId.length - 1); poaId = newID; POANameHasher key = new POANameHasher(poaId); logger.fine("Searching POA hierarchy for " + key); poa = (org.omg.PortableServer.POA) poas_.get(key); if (poa != null) { logger.fine("Located POA using " + key); break; } } while (poaId.length > 0); // // Now find each POA in the path until we fail to find one of // the POA's or we're done. // for (int i = remaining.size(); i > 0 && poa != null; i--) { String key = (String) remaining.elementAt(i - 1); try { logger.fine("Searching up hierarchy using key " + key); poa = poa.find_POA(key, true); } catch (org.omg.PortableServer.POAPackage.AdapterNonExistent ex) { logger.fine("Failure locating POA using key " + key); poa = null; } } } return poa; } // // Add a POA // synchronized void add(org.omg.PortableServer.POA poa, String[] id) { POANameHasher idkey = new POANameHasher(id); logger.fine("Adding POA to locater using key " + idkey); org.apache.yoko.orb.OB.Assert._OB_assert(!poas_.containsKey(idkey)); poas_.put(idkey, poa); } // // Remove a POA // synchronized void remove(String[] id) { POANameHasher idkey = new POANameHasher(id); logger.fine("Removing POA from locater using key " + idkey); org.apache.yoko.orb.OB.Assert._OB_assert(poas_.containsKey(idkey)); poas_.remove(idkey); } }
6,826
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/OBPortableServer/NonRetainStrategy.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.OBPortableServer; // // Strategy for NON_RETAIN and USE_SERVANT_MANAGER or // USE_DEFAULT_SERVANT // class NonRetainStrategy implements ServantLocationStrategy { private ServantLocatorStrategy servantManager_; private DefaultServantHolder defaultServant_; NonRetainStrategy(ServantLocatorStrategy servantManager, DefaultServantHolder defaultServant) { servantManager_ = servantManager; defaultServant_ = defaultServant; } public void destroy(org.omg.PortableServer.POA poa, boolean etherealize) { if (servantManager_ != null) servantManager_.destroy(); if (defaultServant_ != null) defaultServant_.destroy(); } public void etherealize(org.omg.PortableServer.POA poa) { // Do nothing } public void activate(byte[] oid, org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.ServantAlreadyActive, org.omg.PortableServer.POAPackage.WrongPolicy, org.omg.PortableServer.POAPackage.ObjectAlreadyActive { // // Requires the RETAIN policy. // throw new org.omg.PortableServer.POAPackage.WrongPolicy(); } public void deactivate(org.omg.PortableServer.POA poa, byte[] oid) throws org.omg.PortableServer.POAPackage.ObjectNotActive, org.omg.PortableServer.POAPackage.WrongPolicy { // // Requires the RETAIN policy. // throw new org.omg.PortableServer.POAPackage.WrongPolicy(); } public byte[] servantToId(org.omg.PortableServer.Servant servant, org.apache.yoko.orb.PortableServer.Current_impl poaCurrent) { if (defaultServant_ != null) return defaultServant_.servantToId(servant, poaCurrent); return null; } public org.omg.PortableServer.Servant idToServant(byte[] oid, boolean useDefaultServant) { if (defaultServant_ != null) return defaultServant_.getDefaultServant(); return null; } public org.omg.PortableServer.Servant locate(byte[] oid, org.omg.PortableServer.POA poa, String op, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) throws org.apache.yoko.orb.OB.LocationForward { if (defaultServant_ != null) { org.omg.PortableServer.Servant servant = defaultServant_ .getDefaultServant(); if (servant == null) throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorNoDefaultServant), org.apache.yoko.orb.OB.MinorCodes.MinorNoDefaultServant, org.omg.CORBA.CompletionStatus.COMPLETED_NO); return servant; } if (servantManager_ == null) throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager), org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager, org.omg.CORBA.CompletionStatus.COMPLETED_NO); return servantManager_.preinvoke(oid, poa, op, cookie); } public void preinvoke(byte[] oid) { } public void postinvoke(byte[] oid, org.omg.PortableServer.POA poa, String op, java.lang.Object cookie, org.omg.PortableServer.Servant servant) { if (servantManager_ != null) servantManager_.postinvoke(oid, poa, op, cookie, servant); } public DirectServant createDirectStubImpl(org.omg.PortableServer.POA poa, byte[] oid, org.apache.yoko.orb.OB.RefCountPolicyList policies) throws org.apache.yoko.orb.OB.LocationForward { return null; } public void removeDirectStubImpl(byte[] oid, DirectServant servant) { } public ServantManagerStrategy getServantManagerStrategy() { return servantManager_; } public DefaultServantHolder getDefaultServantHolder() { return defaultServant_; } }
6,827
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/OBPortableServer/POAControl.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.OBPortableServer; // // This class is used to control the POA // class POAControl { private final static int DestroyNotCalled = 0; private final static int DestroyPending = 1; private final static int DestroyInProgress = 2; private final static int DestroyCompleted = 3; // // The POA state // private int state_; // // Should the servants be etherealized? // private boolean etherealize_; // // How many pending requests are there? // private int requests_; // ---------------------------------------------------------------------- // Package member implementations // ---------------------------------------------------------------------- POAControl() { state_ = DestroyNotCalled; etherealize_ = false; requests_ = 0; } // // Mark the state as destroy pending. Return true if the destroy // should complete, false otherwise. // synchronized boolean markDestroyPending(boolean etherealize, boolean waitForCompletion) { // // If the POA is in the middle of a destroy and // waitForCompletion is true then wait for the destroy to // complete. // if (state_ != DestroyNotCalled) { while (waitForCompletion && state_ != DestroyCompleted) { // // wait for the destroy to complete // try { wait(); } catch (InterruptedException ex) { } } return false; } // // Save the etherealize flag. Set the state to DestroyPending. // etherealize_ = etherealize; state_ = DestroyPending; return true; } // // Increment the outstanding request count. Return true if the POA // is not destroyed, false otherwise. // synchronized boolean incrementRequestCount() { if (state_ != DestroyNotCalled) { while (state_ != DestroyCompleted) { // // wait for the destroy to complete // try { wait(); } catch (InterruptedException ex) { } } return false; } // // Reference successfully acquired, return true // requests_++; return true; } // // Decrement the outstanding request count. If the state is // DestroyPending then wake any waiting threads and return true. // synchronized boolean decrementRequestCount() { org.apache.yoko.orb.OB.Assert._OB_assert(requests_ > 0); requests_--; // // If we have no more outstanding requests notify anyone // waiting for this state // if (requests_ == 0) { notifyAll(); if (state_ == DestroyPending) return true; } return false; } // // Wait for any pending requests to terminate. Return true if // the destroy should complete, false otherwise. // synchronized boolean waitPendingRequests() { while (requests_ > 0) { // // wait for the destroy to complete // try { wait(); } catch (InterruptedException ex) { } } // // If the state is not DestroyPending then some other thread // is in the progress of completing destroying the POA // if (state_ != DestroyPending) return false; state_ = DestroyInProgress; return true; } // // Return true if there are outstanding pending requests // synchronized boolean hasPendingRequests() { return requests_ > 0; } // // Has the POA been destroyed? // synchronized boolean getDestroyed() { return state_ == DestroyCompleted; } // // Mark the state as DestroyCompleted, wake any waiting threads // synchronized void markDestroyCompleted() { state_ = DestroyCompleted; notifyAll(); } // // Should etherealize be called? // synchronized boolean etherealize() { return etherealize_; } }
6,828
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/OBPortableServer/SynchronizationPolicyHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicy:1.0 // final public class SynchronizationPolicyHelper { public static void insert(org.omg.CORBA.Any any, SynchronizationPolicy val) { any.insert_Object(val, type()); } public static SynchronizationPolicy 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(), "SynchronizationPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicy:1.0"; } public static SynchronizationPolicy 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, SynchronizationPolicy 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 SynchronizationPolicy narrow(org.omg.CORBA.Object val) { try { return (SynchronizationPolicy)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,829
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/OBPortableServer/POAManagerHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManager:1.0 // final public class POAManagerHelper { public static void insert(org.omg.CORBA.Any any, POAManager val) { any.insert_Object(val, type()); } public static POAManager 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(), "POAManager"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/POAManager:1.0"; } public static POAManager 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, POAManager 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 POAManager narrow(org.omg.CORBA.Object val) { try { return (POAManager)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,830
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/OBPortableServer/EndpointConfigurationPolicy_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.OBPortableServer; import org.apache.yoko.orb.OBPortableServer.AcceptorConfig; import org.apache.yoko.orb.OBPortableServer.ENDPOINT_CONFIGURATION_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.EndpointConfigurationPolicy; public final class EndpointConfigurationPolicy_impl extends org.omg.CORBA.LocalObject implements EndpointConfigurationPolicy { private AcceptorConfig[] value_; public EndpointConfigurationPolicy_impl(AcceptorConfig[] value) { value_ = value; } public AcceptorConfig[] value() { return value_; } public int policy_type() { return ENDPOINT_CONFIGURATION_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,831
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/OBPortableServer/EndpointConfigurationPolicy.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/EndpointConfigurationPolicy:1.0 // /** * * Endpoint Configuration Policy * **/ public interface EndpointConfigurationPolicy extends EndpointConfigurationPolicyOperations, org.omg.CORBA.Policy { }
6,832
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/OBPortableServer/INTERCEPTOR_CALL_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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/INTERCEPTOR_CALL_POLICY_ID:1.0 // /** * * This policy type identifies the interceptor call policy. * **/ public interface INTERCEPTOR_CALL_POLICY_ID { int value = (int)(1330577667L); }
6,833
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/OBPortableServer/CommunicationsConcurrencyPolicyHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/CommunicationsConcurrencyPolicy:1.0 // final public class CommunicationsConcurrencyPolicyHelper { public static void insert(org.omg.CORBA.Any any, CommunicationsConcurrencyPolicy val) { any.insert_Object(val, type()); } public static CommunicationsConcurrencyPolicy 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(), "CommunicationsConcurrencyPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/CommunicationsConcurrencyPolicy:1.0"; } public static CommunicationsConcurrencyPolicy 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, CommunicationsConcurrencyPolicy 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 CommunicationsConcurrencyPolicy narrow(org.omg.CORBA.Object val) { try { return (CommunicationsConcurrencyPolicy)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,834
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/OBPortableServer/AdapterActivatorHolder.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.OBPortableServer; // // This class is used to hold the adapater activator // class AdapterActivatorHolder { org.omg.PortableServer.AdapterActivator activator_; public synchronized void destroy() { activator_ = null; } public synchronized org.omg.PortableServer.AdapterActivator getAdapterActivator() { return activator_; } public synchronized void setAdapterActivator( org.omg.PortableServer.AdapterActivator activator) { activator_ = activator; } }
6,835
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/OBPortableServer/POAManagerFactoryOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory:1.0 // /** * * This interface is a proprietary extension of the standard * POAManagerFactory. * * @see PortableServer::POAManagerFactory * **/ public interface POAManagerFactoryOperations extends org.omg.PortableServer.POAManagerFactoryOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory/destroy:1.0 // /** * * Destroy all POAManagers. * **/ void destroy(); // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory/create_endpoint_configuration_policy:1.0 // /** * * These policy factory methods creates POAManager policies only. * **/ EndpointConfigurationPolicy create_endpoint_configuration_policy(String value) throws org.omg.CORBA.PolicyError; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory/create_communications_concurrency_policy:1.0 // /***/ CommunicationsConcurrencyPolicy create_communications_concurrency_policy(short value) throws org.omg.CORBA.PolicyError; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory/create_giop_version_policy:1.0 // /***/ GIOPVersionPolicy create_giop_version_policy(short value) throws org.omg.CORBA.PolicyError; }
6,836
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/OBPortableServer/GIOP_VERSION_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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/GIOP_VERSION_POLICY_ID:1.0 // /** * * This policy type identifies the GIOP version policy. * **/ public interface GIOP_VERSION_POLICY_ID { int value = (int)(1330577670L); }
6,837
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/OBPortableServer/TableEntry.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.OBPortableServer; import org.apache.yoko.orb.OB.Assert; class TableEntry { // // The servant // private org.omg.PortableServer.Servant servant_; // // The state of the TableEntry // final static int ACTIVATE_PENDING = 0; // Entry is pending activation final static int ACTIVE = 1; // Entry is active final static int DEACTIVATE_PENDING = 2; // Entry is pending deactivation final static int DEACTIVATED = 3; // Entry has been deactivated private int state_; // // The number of outstanding requests // private int outstandingRequests_; TableEntry() { state_ = ACTIVATE_PENDING; outstandingRequests_ = 0; } void setServant(org.omg.PortableServer.Servant s) { Assert._OB_assert(servant_ == null && s != null && state_ == ACTIVATE_PENDING); servant_ = s; } void clearServant() { Assert._OB_assert(state_ == DEACTIVATED && outstandingRequests_ == 0); servant_ = null; } org.omg.PortableServer.Servant getServant() { Assert._OB_assert(state_ == ACTIVE || state_ == DEACTIVATE_PENDING); return servant_; } // // Is the table entry active? // int state() { return state_; } // // Mark the table entry as activation in progress // void setActive() { state_ = ACTIVE; notifyAll(); } // // Mark the table entry as deactivate pending // void setDeactivatePending() { state_ = DEACTIVATE_PENDING; notifyAll(); } // // Mark the deactivation of the table entry as complete // void setDeactivated() { state_ = DEACTIVATED; notifyAll(); } // // Wait for the deactivation of the table entry to complete // void waitForStateChange() { int state = state_; do { try { wait(); } catch (InterruptedException ex) { } } while (state_ == state); } int getOutstandingRequests() { return outstandingRequests_; } void incOutstandingRequest() { outstandingRequests_++; } int decOutstandingRequest() { return --outstandingRequests_; } }
6,838
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/OBPortableServer/ServerDomainHelper.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.OBPortableServer; import org.apache.yoko.orb.IMR.ServerDomain; import org.apache.yoko.orb.IMR._ServerDomainStub; // // IDL:orb.yoko.apache.org/IMR/ServerDomain:1.0 // final public class ServerDomainHelper { public static void insert(org.omg.CORBA.Any any, ServerDomain val) { any.insert_Object(val, type()); } public static ServerDomain 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_ = orb.create_interface_tc(id(), "ServerDomain"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/IMR/ServerDomain:1.0"; } public static ServerDomain read(org.omg.CORBA.portable.InputStream in) { org.omg.CORBA.Object _ob_v = in.read_Object(); try { return (ServerDomain) _ob_v; } catch (ClassCastException ex) { } org.omg.CORBA.portable.ObjectImpl _ob_impl; _ob_impl = (org.omg.CORBA.portable.ObjectImpl) _ob_v; _ServerDomainStub _ob_stub = new _ServerDomainStub(); _ob_stub._set_delegate(_ob_impl._get_delegate()); return _ob_stub; } public static void write(org.omg.CORBA.portable.OutputStream out, ServerDomain val) { out.write_Object(val); } public static ServerDomain narrow(org.omg.CORBA.Object val) { if (val != null) { try { return (ServerDomain) val; } catch (ClassCastException ex) { } if (val._is_a(id())) { org.omg.CORBA.portable.ObjectImpl _ob_impl; _ServerDomainStub _ob_stub = new _ServerDomainStub(); _ob_impl = (org.omg.CORBA.portable.ObjectImpl) val; _ob_stub._set_delegate(_ob_impl._get_delegate()); return _ob_stub; } 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); } return null; } public static ServerDomain unchecked_narrow(org.omg.CORBA.Object val) { if (val != null) { try { return (ServerDomain) val; } catch (ClassCastException ex) { } org.omg.CORBA.portable.ObjectImpl _ob_impl; _ServerDomainStub _ob_stub = new _ServerDomainStub(); _ob_impl = (org.omg.CORBA.portable.ObjectImpl) val; _ob_stub._set_delegate(_ob_impl._get_delegate()); return _ob_stub; } return null; } }
6,839
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/OBPortableServer/GIOPVersionPolicy.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/GIOPVersionPolicy:1.0 // /** * * GIOP Version Policy * **/ public interface GIOPVersionPolicy extends GIOPVersionPolicyOperations, org.omg.CORBA.Policy { }
6,840
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/OBPortableServer/AcceptorConfigSeqHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfigSeq:1.0 // final public class AcceptorConfigSeqHelper { public static void insert(org.omg.CORBA.Any any, AcceptorConfig[] val) { org.omg.CORBA.portable.OutputStream out = any.create_output_stream(); write(out, val); any.read_value(out.create_input_stream(), type()); } public static AcceptorConfig[] 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(), "AcceptorConfigSeq", orb.create_sequence_tc(0, AcceptorConfigHelper.type())); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfigSeq:1.0"; } public static AcceptorConfig[] read(org.omg.CORBA.portable.InputStream in) { AcceptorConfig[] _ob_v; int len0 = in.read_ulong(); _ob_v = new AcceptorConfig[len0]; for(int i0 = 0; i0 < len0; i0++) _ob_v[i0] = AcceptorConfigHelper.read(in); return _ob_v; } public static void write(org.omg.CORBA.portable.OutputStream out, AcceptorConfig[] val) { int len0 = val.length; out.write_ulong(len0); for(int i0 = 0; i0 < len0; i0++) AcceptorConfigHelper.write(out, val[i0]); } }
6,841
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/OBPortableServer/EndpointConfigurationPolicyHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/EndpointConfigurationPolicy:1.0 // final public class EndpointConfigurationPolicyHelper { public static void insert(org.omg.CORBA.Any any, EndpointConfigurationPolicy val) { any.insert_Object(val, type()); } public static EndpointConfigurationPolicy 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(), "EndpointConfigurationPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/EndpointConfigurationPolicy:1.0"; } public static EndpointConfigurationPolicy 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, EndpointConfigurationPolicy 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 EndpointConfigurationPolicy narrow(org.omg.CORBA.Object val) { try { return (EndpointConfigurationPolicy)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,842
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/OBPortableServer/SynchronizationPolicyValueHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicyValue:1.0 // final public class SynchronizationPolicyValueHolder implements org.omg.CORBA.portable.Streamable { public SynchronizationPolicyValue value; public SynchronizationPolicyValueHolder() { } public SynchronizationPolicyValueHolder(SynchronizationPolicyValue initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = SynchronizationPolicyValueHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { SynchronizationPolicyValueHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return SynchronizationPolicyValueHelper.type(); } }
6,843
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/OBPortableServer/POA_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.OBPortableServer; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.OBPortableServer.DISPATCH_STRATEGY_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.DispatchStrategyPolicy; import org.apache.yoko.orb.OBPortableServer.INTERCEPTOR_CALL_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.POA; import org.apache.yoko.orb.OBPortableServer.POAManager; import org.apache.yoko.orb.OBPortableServer.POAManagerFactory; import org.apache.yoko.orb.OBPortableServer.POAManagerFactoryHelper; import org.apache.yoko.orb.OBPortableServer.POAManagerHelper; import org.apache.yoko.orb.OBPortableServer.SYNCHRONIZATION_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.SynchronizationPolicy; import org.apache.yoko.orb.OBPortableServer.SynchronizationPolicyValue; final public class POA_impl extends org.omg.CORBA.LocalObject implements POA { static final Logger logger = Logger.getLogger(POA_impl.class.getName()); // // The ORB // private org.omg.CORBA.ORB orb_; // // The ORBInstance object // private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // // The name of this POA and the name of the root POA // private String name_; // // The adapter id // private byte[] adapterId_; // // The Server ID (or "_RootPOA" if not set // String serverId_; // // The POA name. This is the full path to the POA. // private String[] poaId_; // // My parent POA // private POA_impl parent_; // // My POA manager // private POAManager manager_; // // My servant location strategy // private ServantLocationStrategy servantLocationStrategy_; // // My POAControl object // private POAControl poaControl_; // // The associated AdapterActivator // private AdapterActivatorHolder adapterActivator_; // // All children of this POA // private java.util.Hashtable children_; // // My policies // private POAPolicies policies_; // // Used for generating object ids // private IdGenerationStrategy idGenerationStrategy_; // // The POA creation time, if not persistent // private int poaCreateTime_; // // If this POA has the single thread policy set then this mutex is // used ensure this policy is met // private org.apache.yoko.orb.OB.RecursiveMutex poaSyncMutex_ = new org.apache.yoko.orb.OB.RecursiveMutex(); private org.apache.yoko.orb.OB.DispatchStrategy dispatchStrategy_; // // The Current implementation. The RootPOA is responsible for the // creation and deletion of the one and only PortableServer::Current. // private org.apache.yoko.orb.PortableServer.Current_impl poaCurrent_; // // The OCI::Current implementation. The RootPOA is responsible for // the creation and deletion of the one and only OCI::Current. // private org.apache.yoko.orb.OCI.Current_impl ociCurrent_; // // This is the set of policies that are not POA policies and are // registered with a valid PolicyFactory // private org.omg.CORBA.Policy[] rawPolicies_; // // The primary, secondary and current ObjectReferenceTemplate // private org.omg.PortableInterceptor.ObjectReferenceTemplate adapterTemplate_; private org.omg.PortableInterceptor.ObjectReferenceFactory currentFactory_; private org.omg.PortableInterceptor.ObjectReferenceFactory ort_; // // The IORInfo // private org.omg.PortableInterceptor.IORInfo iorInfo_; // // The child ORTs required for adapterStateChange call when // POA is destroyed. // private java.util.Vector childTemplates_; // // Should POA call AdapterStateChange when destroyed // boolean callAdapterStateChange_; // ---------------------------------------------------------------------- // POA private member implementation // ---------------------------------------------------------------------- // // Return the appropriate object reference template. // private org.omg.PortableInterceptor.ObjectReferenceFactory ort() { if (ort_ == null) { ort_ = current_factory(); if (ort_ == null) ort_ = adapterTemplate_; } return ort_; } // // Given an object id create an object key // private byte[] createObjectKey(byte[] id) { return org.apache.yoko.orb.OB.ObjectKey .CreateObjectKey(new org.apache.yoko.orb.OB.ObjectKeyData( serverId_, poaId_, id, policies_.lifespanPolicy() == org.omg.PortableServer.LifespanPolicyValue.PERSISTENT, poaCreateTime_)); } // // Find the index of the given policy // private boolean findPolicyIndex(org.omg.CORBA.Policy[] p, int type, org.omg.CORBA.IntHolder i) { for (i.value = 0; i.value < p.length; i.value++) if (p[i.value].policy_type() == type) return true; return false; } // // Validate a specific set of POA policies // private boolean validatePolicies(POAPolicies policies, org.omg.CORBA.Policy[] policyList, org.omg.CORBA.IntHolder i) { // // NON_RETAIN requires either USE_DEFAULT_SERVANT or // USE_SERVANT_MANAGER // if (policies.servantRetentionPolicy() == org.omg.PortableServer.ServantRetentionPolicyValue.NON_RETAIN && policies.requestProcessingPolicy() != org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER && policies.requestProcessingPolicy() != org.omg.PortableServer.RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) { boolean ok = findPolicyIndex(policyList, org.omg.PortableServer.SERVANT_RETENTION_POLICY_ID.value, i); org.apache.yoko.orb.OB.Assert._OB_assert(ok); return false; } // // USE_ACTIVE_OBJECT_MAP_ONLY requires RETAIN // if (policies.requestProcessingPolicy() == org.omg.PortableServer.RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY && policies.servantRetentionPolicy() != org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN) { // // One of the two must be present // boolean ok = findPolicyIndex(policyList, org.omg.PortableServer.SERVANT_RETENTION_POLICY_ID.value, i); if (!ok) ok = findPolicyIndex( policyList, org.omg.PortableServer.REQUEST_PROCESSING_POLICY_ID.value, i); org.apache.yoko.orb.OB.Assert._OB_assert(ok); return false; } // // USE_DEFAULT_SERVANT requires MULTIPLE_ID // if (policies.requestProcessingPolicy() == org.omg.PortableServer.RequestProcessingPolicyValue.USE_DEFAULT_SERVANT && policies.idUniquenessPolicy() != org.omg.PortableServer.IdUniquenessPolicyValue.MULTIPLE_ID) { // // Since USE_DEFAULT_SERVANT, this must be present // boolean ok = findPolicyIndex(policyList, org.omg.PortableServer.REQUEST_PROCESSING_POLICY_ID.value, i); org.apache.yoko.orb.OB.Assert._OB_assert(ok); return false; } // // IMPLICIT_ACTIVATION requires SYSTEM_ID and RETAIN // if (policies.implicitActivationPolicy() == org.omg.PortableServer.ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION && policies.servantRetentionPolicy() != org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN && policies.idAssignmentPolicy() != org.omg.PortableServer.IdAssignmentPolicyValue.SYSTEM_ID) { // // Since IMPLICIT_ACTIVATION , this must be present // boolean ok = findPolicyIndex(policyList, org.omg.PortableServer.IMPLICIT_ACTIVATION_POLICY_ID.value, i); org.apache.yoko.orb.OB.Assert._OB_assert(ok); return false; } return true; } // // Handle unknown exceptions // private void handleUnknownException(org.apache.yoko.orb.OB.Upcall upcall, Exception ex) { org.apache.yoko.orb.OB.UnknownExceptionStrategy strategy = orbInstance_ .getUnknownExceptionStrategy(); org.apache.yoko.orb.OB.UnknownExceptionInfo info = new org.apache.yoko.orb.OB.UnknownExceptionInfo_impl( upcall.operation(), upcall.responseExpected(), upcall .transportInfo(), (RuntimeException) ex); try { strategy.unknown_exception(info); // // Return CORBA::UNKNOWN if the strategy doesn't raise // an exception // upcall.setSystemException(new org.omg.CORBA.UNKNOWN()); } catch (org.omg.CORBA.SystemException sysEx) { upcall.setSystemException(sysEx); } catch (RuntimeException rex) { upcall.setSystemException(new org.omg.CORBA.UNKNOWN()); } } // // Complete the destroy of the POA // private void completeDestroy() { logger.fine("Completing destroy of POA " + name_ + " using POAContrl " + poaControl_); // // Wait for all pending requests to terminate. If the POA has // destruction has already completed waitPendingRequests // returns false. // if (poaControl_.waitPendingRequests()) { // // Remove this POA from our parent // if (parent_ != null) { synchronized (parent_.children_) { org.apache.yoko.orb.OB.Assert._OB_assert(parent_.children_ .containsKey(name_)); parent_.children_.remove(name_); } } // // Unregister from the POAManager If the manager_ is nil then // the POA is being destroyed on startup. // if (manager_ != null) { POAManager_impl m = (POAManager_impl) manager_; m._OB_removePOA(poaId_); manager_ = null; } // // Call the adapter_state_change hook // if (callAdapterStateChange_) { org.omg.PortableInterceptor.ObjectReferenceTemplate[] orts = new org.omg.PortableInterceptor.ObjectReferenceTemplate[childTemplates_ .size()]; childTemplates_.copyInto(orts); org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); piManager.adapterStateChange(orts, org.omg.PortableInterceptor.NON_EXISTENT.value); } // // Destroy the servant location strategy // servantLocationStrategy_.destroy(this, poaControl_.etherealize()); // // Clear internal state variables // adapterActivator_.destroy(); // // Clear the ORB reference // orb_ = null; // // Mark the destroy as complete // poaControl_.markDestroyCompleted(); logger.fine("POA " + name_ + " is in a destroyed state"); // // Release the IORInfo object now // iorInfo_ = null; } } // // Common initialization code // private void init() { // // Set the POA create time // poaCreateTime_ = (int) (System.currentTimeMillis() / 1000); // // Setup the adapter id. This ID is unique for the lifespan of // this POA. // // TODO: It would be nicer if this didn't use CreateObjectKey // byte[] oid = new byte[0]; org.apache.yoko.orb.OB.ObjectKeyData data = new org.apache.yoko.orb.OB.ObjectKeyData( serverId_, poaId_, oid, policies_.lifespanPolicy() == org.omg.PortableServer.LifespanPolicyValue.PERSISTENT, poaCreateTime_); adapterId_ = org.apache.yoko.orb.OB.ObjectKey.CreateObjectKey(data); // // Setup the object-reference templates for this POA. This // involves running the IORInterceptor to establish the IOR // components, and after calling the components_established // interception point. // org.apache.yoko.orb.OBPortableServer.POAManager_impl m = (org.apache.yoko.orb.OBPortableServer.POAManager_impl) manager_; org.apache.yoko.orb.OCI.Acceptor[] acceptors = m._OB_getAcceptors(); // // Create the IORInfo for this POA // org.apache.yoko.orb.PortableInterceptor.IORInfo_impl iorInfoImpl = new org.apache.yoko.orb.PortableInterceptor.IORInfo_impl( orbInstance_, acceptors, rawPolicies_, policies_, m._OB_getAdapterManagerId(), m ._OB_getAdapterState()); iorInfo_ = iorInfoImpl; // // Establish the components to place in IORs generated by this // POA. // org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); piManager.establishComponents(iorInfo_); // // Once the components have been established the IORTemplate can // be created for this POA. // org.omg.IOP.IOR iorTemplate = new org.omg.IOP.IOR(); iorTemplate.profiles = new org.omg.IOP.TaggedProfile[0]; iorTemplate.type_id = new String(); org.omg.IOP.IORHolder iorH = new org.omg.IOP.IORHolder(iorTemplate); iorInfoImpl._OB_addComponents(iorH, m._OB_getGIOPVersion()); // // Create the primary, secondary and current object-reference // template. // String orbId = orbInstance_.getOrbId(); String serverId = orbInstance_.getServerId(); logger.fine("POA " + name_ + " activated on ORB " + orbId + " and server " + serverId); if (policies_.lifespanPolicy() == org.omg.PortableServer.LifespanPolicyValue.PERSISTENT) adapterTemplate_ = new org.apache.yoko.orb.OBPortableInterceptor.PersistentORT_impl( orbInstance_, serverId, orbId, poaId_, iorTemplate); else adapterTemplate_ = new org.apache.yoko.orb.OBPortableInterceptor.TransientORT_impl( orbInstance_, serverId, orbId, poaId_, poaCreateTime_, iorTemplate); // // Set the primary template // iorInfoImpl._OB_adapterTemplate(adapterTemplate_); // // Call the componentsEstablished callback. This method can throw // an exception. // piManager.componentsEstablished(iorInfo_); // // After this point no exception should be thrown // // // Create the id generation strategy // idGenerationStrategy_ = IdGenerationStrategyFactory .createIdGenerationStrategy(policies_); // // Create the adapter activator holder // adapterActivator_ = new AdapterActivatorHolder(); // // Create the POA control // poaControl_ = new POAControl(); // // Initialize the ServantLocationStategy // servantLocationStrategy_ = ServantLocationStrategyFactory .createServantLocationStrategy(policies_, orbInstance_); // // Initialize the POA child hashtable // children_ = new java.util.Hashtable(31); // // Initialize the dispatch strategy // dispatchStrategy_ = policies_.dispatchStrategyPolicy(); // // Register with the POAManager // m._OB_addPOA(this, poaId_); } // ---------------------------------------------------------------------- // POA_impl constructors // ---------------------------------------------------------------------- // // Constructor for any POA other than the root // private POA_impl(org.omg.CORBA.ORB orb, org.apache.yoko.orb.OB.ORBInstance orbInstance, String serverId, String name, POA_impl parent, POAManager manager, org.apache.yoko.orb.PortableServer.Current_impl poaCurrent, org.apache.yoko.orb.OCI.Current_impl ociCurrent, POAPolicies policies, org.omg.CORBA.Policy[] rawPolicies) { orb_ = orb; orbInstance_ = orbInstance; serverId_ = serverId; name_ = name; parent_ = parent; manager_ = manager; policies_ = policies; poaCurrent_ = poaCurrent; ociCurrent_ = ociCurrent; rawPolicies_ = rawPolicies; adapterTemplate_ = null; currentFactory_ = null; ort_ = null; childTemplates_ = new java.util.Vector(); callAdapterStateChange_ = true; logger.fine("Creating POA " + name + " using manager " + manager.get_id()); // // Set my POA id // org.apache.yoko.orb.OB.Assert._OB_assert(parent != null); poaId_ = new String[parent.poaId_.length + 1]; System.arraycopy(parent.poaId_, 0, poaId_, 0, parent.poaId_.length); poaId_[parent.poaId_.length] = name; init(); } // // Constructor for the root POA // public POA_impl(org.omg.CORBA.ORB orb, org.apache.yoko.orb.OB.ORBInstance orbInstance, String name, POAManager manager) { orb_ = orb; orbInstance_ = orbInstance; serverId_ = name; name_ = name; parent_ = null; manager_ = manager; policies_ = null; poaCurrent_ = null; ociCurrent_ = null; adapterTemplate_ = null; currentFactory_ = null; ort_ = null; childTemplates_ = new java.util.Vector(); callAdapterStateChange_ = true; org.omg.CORBA.Policy[] pl = new org.omg.CORBA.Policy[1]; pl[0] = new org.apache.yoko.orb.PortableServer.ImplicitActivationPolicy_impl( org.omg.PortableServer.ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION); // // Create the policies_ member // policies_ = new POAPolicies(orbInstance_, pl); // // This is the default externally visible for the RootPOA // rawPolicies_ = new org.omg.CORBA.Policy[7]; rawPolicies_[0] = new org.apache.yoko.orb.PortableServer.ThreadPolicy_impl( org.omg.PortableServer.ThreadPolicyValue.ORB_CTRL_MODEL); rawPolicies_[1] = new org.apache.yoko.orb.PortableServer.LifespanPolicy_impl( org.omg.PortableServer.LifespanPolicyValue.TRANSIENT); rawPolicies_[2] = new org.apache.yoko.orb.PortableServer.IdUniquenessPolicy_impl( org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID); rawPolicies_[3] = new org.apache.yoko.orb.PortableServer.IdAssignmentPolicy_impl( org.omg.PortableServer.IdAssignmentPolicyValue.SYSTEM_ID); rawPolicies_[4] = new org.apache.yoko.orb.PortableServer.ServantRetentionPolicy_impl( org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN); rawPolicies_[5] = new org.apache.yoko.orb.PortableServer.RequestProcessingPolicy_impl( org.omg.PortableServer.RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY); rawPolicies_[6] = new org.apache.yoko.orb.PortableServer.ImplicitActivationPolicy_impl( org.omg.PortableServer.ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION); // // Create the POA and OCI Current implementation object // poaCurrent_ = new org.apache.yoko.orb.PortableServer.Current_impl(); ociCurrent_ = new org.apache.yoko.orb.OCI.Current_impl(); // // Register the POA::Current, and the OCI::Current classes with // the ORB // org.apache.yoko.orb.OB.InitialServiceManager ism = orbInstance_ .getInitialServiceManager(); try { ism.addInitialReference("POACurrent", poaCurrent_); ism.addInitialReference("OCICurrent", ociCurrent_); } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } // // Set the POAID // poaId_ = new String[0]; // // Initialize the POA // init(); } protected void finalize() throws Throwable { org.apache.yoko.orb.OB.Assert._OB_assert(poaControl_.getDestroyed()); super.finalize(); } // ---------------------------------------------------------------------- // Standard IDL to Java mapping // ---------------------------------------------------------------------- public org.omg.PortableServer.POA create_POA(String adapter, org.omg.PortableServer.POAManager manager, org.omg.CORBA.Policy[] rawPolicies) throws org.omg.PortableServer.POAPackage.AdapterAlreadyExists, org.omg.PortableServer.POAPackage.InvalidPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(adapter != null); // // Has the POA been destroyed? // if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } logger.fine("POA " + name_ + " creating new POA with name " + adapter); // // Are the requested policies valid? // POAPolicies policies = new POAPolicies(orbInstance_, rawPolicies); org.omg.CORBA.IntHolder idx = new org.omg.CORBA.IntHolder(); if (!validatePolicies(policies, rawPolicies, idx)) throw new org.omg.PortableServer.POAPackage.InvalidPolicy( (short) idx.value); POA_impl child = null; // // It's not possible to a POA that already exists. If the POA is // being destroyed an AdapterAlreadyExists exception is still // thrown -- the application has to be capable of dealing with this // (by calling create_POA again) // synchronized (children_) { if (children_.containsKey(adapter)) { throw new org.omg.PortableServer.POAPackage.AdapterAlreadyExists(); } // // If necessary create a new POAManager for this POA // POAManager obmanager = null; if (manager == null) { try { org.apache.yoko.orb.OB.InitialServiceManager ism = orbInstance_ .getInitialServiceManager(); POAManagerFactory factory = POAManagerFactoryHelper .narrow(ism.resolveInitialReferences("POAManagerFactory")); org.omg.CORBA.Policy[] emptyPl = new org.omg.CORBA.Policy[0]; obmanager = (org.apache.yoko.orb.OBPortableServer.POAManager) factory .create_POAManager(adapter, emptyPl); } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (org.omg.PortableServer.POAManagerFactoryPackage.ManagerAlreadyExists ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } // catch(org.apache.yoko.orb.OCI.InvalidParam ex) // { // org.apache.yoko.orb.OB.Assert._OB_assert(ex); // } catch (org.omg.CORBA.PolicyError ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } } else { try { obmanager = POAManagerHelper.narrow(manager); } catch (org.omg.CORBA.BAD_PARAM ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } } // // Create the new POA // try { child = new POA_impl(orb_, orbInstance_, serverId_, adapter, this, obmanager, poaCurrent_, ociCurrent_, policies, rawPolicies); } catch (org.omg.CORBA.SystemException ex) { // // If the creation of the POA fails and a new POAManager // was created the deactivate the POAManager // if (manager == null) { org.apache.yoko.orb.OB.Assert._OB_assert(obmanager != null); try { obmanager.deactivate(true, true); } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive e) { } } throw ex; } // // Add this to the child list // children_.put(adapter, child); } return child; } public org.omg.PortableServer.POA find_POA(String adapter, boolean activate) throws org.omg.PortableServer.POAPackage.AdapterNonExistent { org.apache.yoko.orb.OB.Assert._OB_assert(adapter != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } logger.fine("POA " + name_ + " finding POA with name " + adapter); boolean check = true; // // If the child isn't registered, and we've been asked to // activate the POA and we have an AdapterActivator and the // POAManager's state is active then we activate the POA (see // below requirement) // // From 11-18: // // In addition, when a POA manager is in the holding state, // the adapter activators registered with the associated POAs // will not get called. // if (!children_.containsKey(adapter) && activate) { org.omg.PortableServer.AdapterActivator adapterActivator = adapterActivator_ .getAdapterActivator(); if (adapterActivator != null) { // // From the spec: // // Creating a POA using a POA manager that is in the // active state can lead to race conditions if the POA // supports preexisting objects, because the new POA // may receive a request before its adapter activator, // servant manager, or default servant have been // initialized. These problems do not occur if the POA // is created by an adapter activator registered with // a parent of the new POA, because requests are // queued until the adapter activator returns. To // avoid these problems when a POA must be explicitly // initialized, the application can initialize the POA // by invoking find_POA with a TRUE activate // parameter. // // TODO: This requirement is not met // try { check = adapterActivator.unknown_adapter(this, adapter); } catch (org.omg.CORBA.SystemException ex) { // // 11.3.3.2: // // If unknown_adapter raises a system exception, the ORB // will report an OBJ_ADAPTER system exception with // standard minor code 1. // throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorSystemExceptionInUnknownAdapter), org.apache.yoko.orb.OB.MinorCodes.MinorSystemExceptionInUnknownAdapter, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } } } // // Lookup the POA in our set of children. // org.omg.PortableServer.POA poa = null; if (check) poa = (org.omg.PortableServer.POA) children_.get(adapter); if (poa == null) throw new org.omg.PortableServer.POAPackage.AdapterNonExistent(); return poa; } public void destroy(boolean etherealize, boolean waitForCompletion) { _OB_destroy(etherealize, waitForCompletion, null); } // ---------------------------------------------------------------------- // Factories for policy objects // ---------------------------------------------------------------------- // // These methods don't bother to check to see if the POA has // already been destroyed // public org.omg.PortableServer.ThreadPolicy create_thread_policy( org.omg.PortableServer.ThreadPolicyValue value) { return new org.apache.yoko.orb.PortableServer.ThreadPolicy_impl(value); } public org.omg.PortableServer.LifespanPolicy create_lifespan_policy( org.omg.PortableServer.LifespanPolicyValue value) { return new org.apache.yoko.orb.PortableServer.LifespanPolicy_impl(value); } public org.omg.PortableServer.IdUniquenessPolicy create_id_uniqueness_policy( org.omg.PortableServer.IdUniquenessPolicyValue value) { return new org.apache.yoko.orb.PortableServer.IdUniquenessPolicy_impl( value); } public org.omg.PortableServer.IdAssignmentPolicy create_id_assignment_policy( org.omg.PortableServer.IdAssignmentPolicyValue value) { return new org.apache.yoko.orb.PortableServer.IdAssignmentPolicy_impl( value); } public org.omg.PortableServer.ImplicitActivationPolicy create_implicit_activation_policy( org.omg.PortableServer.ImplicitActivationPolicyValue value) { return new org.apache.yoko.orb.PortableServer.ImplicitActivationPolicy_impl( value); } public org.omg.PortableServer.ServantRetentionPolicy create_servant_retention_policy( org.omg.PortableServer.ServantRetentionPolicyValue value) { return new org.apache.yoko.orb.PortableServer.ServantRetentionPolicy_impl( value); } public org.omg.PortableServer.RequestProcessingPolicy create_request_processing_policy( org.omg.PortableServer.RequestProcessingPolicyValue value) { return new org.apache.yoko.orb.PortableServer.RequestProcessingPolicy_impl( value); } public SynchronizationPolicy create_synchronization_policy( SynchronizationPolicyValue value) { return new SynchronizationPolicy_impl(value); } public DispatchStrategyPolicy create_dispatch_strategy_policy( org.apache.yoko.orb.OB.DispatchStrategy value) { return new DispatchStrategyPolicy_impl(value); } // ---------------------------------------------------------------------- // POA attributes // ---------------------------------------------------------------------- public String the_name() { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } return name_; } public org.omg.PortableServer.POA the_parent() { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } return parent_; } public org.omg.PortableServer.POA[] the_children() { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // // Since its possible that the children list changes while // this method call is in progress its necessary to check the // return value of Hashtable::get. // java.util.Vector content = new java.util.Vector(); java.util.Enumeration e = children_.elements(); while (e.hasMoreElements()) { org.omg.PortableServer.POA child = (org.omg.PortableServer.POA) e.nextElement(); if (child != null) { content.addElement(child); } } org.omg.PortableServer.POA[] children = new org.omg.PortableServer.POA[content.size()]; content.copyInto(children); return children; } public org.omg.PortableServer.POAManager the_POAManager() { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } return manager_; } public org.omg.PortableServer.POAManagerFactory the_POAManagerFactory() { return orbInstance_.getPOAManagerFactory(); } public org.omg.PortableServer.AdapterActivator the_activator() { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } return adapterActivator_.getAdapterActivator(); } public void the_activator(org.omg.PortableServer.AdapterActivator activator) { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } adapterActivator_.setAdapterActivator(activator); } public org.omg.CORBA.Policy[] the_policies() { return policies_.recreate(); } public org.apache.yoko.orb.OB.DispatchStrategy the_dispatch_strategy() { return policies_.dispatchStrategyPolicy(); } public org.omg.PortableInterceptor.ObjectReferenceTemplate adapter_template() { return adapterTemplate_; } public org.omg.PortableInterceptor.ObjectReferenceFactory current_factory() { if (iorInfo_ != null) { try { return ((org.apache.yoko.orb.PortableInterceptor.IORInfo_impl) iorInfo_) .current_factory(); } catch (ClassCastException e) { return iorInfo_.current_factory(); } } return null; } public org.omg.CORBA.ORB the_ORB() { return orb_; } // ---------------------------------------------------------------------- // Servant manager registration // ---------------------------------------------------------------------- public org.omg.PortableServer.ServantManager get_servant_manager() throws org.omg.PortableServer.POAPackage.WrongPolicy { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } ServantManagerStrategy servantManagerStrategy = servantLocationStrategy_ .getServantManagerStrategy(); if (servantManagerStrategy == null) { throw new org.omg.PortableServer.POAPackage.WrongPolicy(); } return servantManagerStrategy.getServantManager(); } public void set_servant_manager(org.omg.PortableServer.ServantManager mgr) throws org.omg.PortableServer.POAPackage.WrongPolicy { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } ServantManagerStrategy servantManagerStrategy = servantLocationStrategy_ .getServantManagerStrategy(); if (servantManagerStrategy == null) throw new org.omg.PortableServer.POAPackage.WrongPolicy(); servantManagerStrategy.setServantManager(mgr); } public org.omg.PortableServer.Servant get_servant() throws org.omg.PortableServer.POAPackage.NoServant, org.omg.PortableServer.POAPackage.WrongPolicy { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } DefaultServantHolder defaultServantHolder = servantLocationStrategy_ .getDefaultServantHolder(); if (defaultServantHolder == null) throw new org.omg.PortableServer.POAPackage.WrongPolicy(); org.omg.PortableServer.Servant servant = defaultServantHolder .getDefaultServant(); if (servant == null) throw new org.omg.PortableServer.POAPackage.NoServant(); return servant; } public void set_servant(org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(servant != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } DefaultServantHolder defaultServantHolder = servantLocationStrategy_ .getDefaultServantHolder(); if (defaultServantHolder == null) throw new org.omg.PortableServer.POAPackage.WrongPolicy(); ((org.omg.CORBA_2_3.ORB) orbInstance_.getORB()).set_delegate(servant); defaultServantHolder.setDefaultServant(servant); } public byte[] activate_object(org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.ServantAlreadyActive, org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(servant != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } byte[] oid = idGenerationStrategy_.createId(); try { servantLocationStrategy_.activate(oid, servant); } catch (org.omg.PortableServer.POAPackage.ObjectAlreadyActive ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); // Should not // occur } return oid; } public void notifyRouters(boolean activate, byte[] oid) { // // Get the list of routers for this target // org.omg.MessageRouting.RouterListHolder configRouterList = new org.omg.MessageRouting.RouterListHolder(); configRouterList.value = new org.omg.MessageRouting.Router[0]; org.apache.yoko.orb.OB.MessageRoutingUtil.getRouterListFromConfig( orbInstance_, configRouterList); int numRouters = configRouterList.value.length; for (int i = 0; i < numRouters; ++i) { org.omg.MessageRouting.Router curRouter = configRouterList.value[i]; // // Get the router admin // org.omg.MessageRouting.RouterAdmin routerAdmin = null; try { routerAdmin = curRouter.admin(); } catch (org.omg.CORBA.SystemException ex) { } // // Only continue if the router could be contacted and a valid // router admin object is available // if (routerAdmin != null) { org.omg.CORBA.Object dest; try { dest = id_to_reference(oid); } catch (org.omg.PortableServer.POAPackage.ObjectNotActive ex) { break; } catch (org.omg.PortableServer.POAPackage.WrongPolicy ex) { break; } if (activate) { org.apache.yoko.orb.OBMessageRouting.ImmediateSuspendPolicy_impl retryPolicy = new org.apache.yoko.orb.OBMessageRouting.ImmediateSuspendPolicy_impl(); int decaySeconds = 0; org.apache.yoko.orb.OBMessageRouting.DecayPolicy_impl decayPolicy = new org.apache.yoko.orb.OBMessageRouting.DecayPolicy_impl( decaySeconds); // // The object itself must be registered with the router // admin. The 'oid' parameter can be used to create a // reference for this object. // try { routerAdmin.register_destination(dest, false, retryPolicy, decayPolicy); } catch (org.omg.CORBA.SystemException ex) { } } else // deactivate { try { routerAdmin.unregister_destination(dest); } catch (org.omg.MessageRouting.InvalidState ex) { } catch (org.omg.CORBA.SystemException ex) { } } } } } public void activate_object_with_id(byte[] oid, org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.ServantAlreadyActive, org.omg.PortableServer.POAPackage.ObjectAlreadyActive, org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(servant != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // // Validate that the ObjectId is valid // if (!idGenerationStrategy_.isValid(oid)) throw new org.omg.CORBA.BAD_PARAM( org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorInvalidObjectId) + ": POA has SYSTEM_ID policy but the object ID was not " + "generated by this POA", org.apache.yoko.orb.OB.MinorCodes.MinorInvalidObjectId, org.omg.CORBA.CompletionStatus.COMPLETED_NO); servantLocationStrategy_.activate(oid, servant); // // Notify associated routers of activation // notifyRouters(true, oid); } public void deactivate_object(byte[] oid) throws org.omg.PortableServer.POAPackage.ObjectNotActive, org.omg.PortableServer.POAPackage.WrongPolicy { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } servantLocationStrategy_.deactivate(this, oid); // // Notify associated routers of activation // notifyRouters(false, oid); } public org.omg.CORBA.Object create_reference(String intf) throws org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(intf != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } byte[] oid = idGenerationStrategy_.createId(); return ort().make_object(intf, oid); } public org.omg.CORBA.Object create_reference_with_id(byte[] oid, String intf) { org.apache.yoko.orb.OB.Assert._OB_assert(intf != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // // Validate that the ObjectId is valid // if (!idGenerationStrategy_.isValid(oid)) throw new org.omg.CORBA.BAD_PARAM( org.apache.yoko.orb.OB.MinorCodes .describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorInvalidObjectId) + ": POA has SYSTEM_ID policy but the object ID was not " + "generated by this POA", org.apache.yoko.orb.OB.MinorCodes.MinorInvalidObjectId, org.omg.CORBA.CompletionStatus.COMPLETED_NO); return ort().make_object(intf, oid); } public byte[] servant_to_id(org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.ServantNotActive, org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(servant != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // // Requires USE_DEFAULT_SERVANT policy or RETAIN policy and // either the UNIQUE_ID policy or the IMPLICIT_ACTIVATION (w/ // SYSTEM_ID) policies. // if (policies_.requestProcessingPolicy() != org.omg.PortableServer.RequestProcessingPolicyValue.USE_DEFAULT_SERVANT && (policies_.servantRetentionPolicy() != org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN || (policies_ .idUniquenessPolicy() != org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID && policies_ .implicitActivationPolicy() != org.omg.PortableServer.ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))) throw new org.omg.PortableServer.POAPackage.WrongPolicy(); byte[] oid = servantLocationStrategy_.servantToId(servant, poaCurrent_); if (oid == null) { // // If the POA doesn't have the IMPLICIT_ACTIVATION // (w/ SYSTEM_ID) then a ServantNotActive exception // if (policies_.implicitActivationPolicy() != org.omg.PortableServer.ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) throw new org.omg.PortableServer.POAPackage.ServantNotActive(); try { oid = activate_object(servant); } catch (org.omg.PortableServer.POAPackage.ServantAlreadyActive ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); // Should // not occur } } return oid; } public org.omg.CORBA.Object servant_to_reference( org.omg.PortableServer.Servant servant) throws org.omg.PortableServer.POAPackage.ServantNotActive, org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(servant != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // // If the operation was invoked in the context of executing // request on the specified servant, the reference associated // with the current invocation is returned. // if (poaCurrent_._OB_inUpcall() && poaCurrent_._OB_getServant() == servant) { try { byte[] oid = poaCurrent_.get_object_id(); String intf = servant._all_interfaces(this, oid)[0]; return ort().make_object(intf, oid); } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } } byte[] oid = servant_to_id(servant); String intf = servant._all_interfaces(this, oid)[0]; return create_reference_with_id(oid, intf); } public org.omg.PortableServer.Servant reference_to_servant( org.omg.CORBA.Object reference) throws org.omg.PortableServer.POAPackage.ObjectNotActive, org.omg.PortableServer.POAPackage.WrongAdapter, org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(reference != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // // Requires the RETAIN policy or the USE_DEFAULT_SERVANT // policy. // if (policies_.servantRetentionPolicy() != org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN && policies_.requestProcessingPolicy() != org.omg.PortableServer.RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) throw new org.omg.PortableServer.POAPackage.WrongPolicy(); byte[] oid = reference_to_id(reference); org.omg.PortableServer.Servant servant = servantLocationStrategy_ .idToServant(oid, true); if (servant == null) throw new org.omg.PortableServer.POAPackage.ObjectNotActive(); return servant; } public byte[] reference_to_id(org.omg.CORBA.Object reference) throws org.omg.PortableServer.POAPackage.WrongAdapter, org.omg.PortableServer.POAPackage.WrongPolicy { org.apache.yoko.orb.OB.Assert._OB_assert(reference != null); if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } org.apache.yoko.orb.CORBA.Delegate d = (org.apache.yoko.orb.CORBA.Delegate) ((org.omg.CORBA.portable.ObjectImpl) reference) ._get_delegate(); org.omg.IOP.IOR ior = d._OB_IOR(); // // Extract the object key from the IOR of the object reference. // org.apache.yoko.orb.OBPortableServer.POAManager_impl m = (org.apache.yoko.orb.OBPortableServer.POAManager_impl) manager_; org.apache.yoko.orb.OCI.Acceptor[] acceptors = m._OB_getAcceptors(); boolean local = false; org.apache.yoko.orb.OCI.ProfileInfo[] profileInfos = null; for (int i = 0; i < acceptors.length && !local; i++) { profileInfos = acceptors[i].get_local_profiles(ior); if (profileInfos.length > 0) local = true; } // // Is the key local? // if (local) { // // Verify the poaIds are the same, have the persistency // values and the same create time if transient // org.apache.yoko.orb.OB.ObjectKeyData keyData = new org.apache.yoko.orb.OB.ObjectKeyData(); if (org.apache.yoko.orb.OB.ObjectKey.ParseObjectKey( profileInfos[0].key, keyData) && _OB_poaMatches(keyData, true)) { return keyData.oid; } } throw new org.omg.PortableServer.POAPackage.WrongAdapter(); } public org.omg.PortableServer.Servant id_to_servant(byte[] oid) throws org.omg.PortableServer.POAPackage.ObjectNotActive, org.omg.PortableServer.POAPackage.WrongPolicy { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // // Requires the RETAIN policy or the USE_DEFAULT_SERVANT policy. // if (policies_.servantRetentionPolicy() != org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN && policies_.requestProcessingPolicy() != org.omg.PortableServer.RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) throw new org.omg.PortableServer.POAPackage.WrongPolicy(); org.omg.PortableServer.Servant servant = servantLocationStrategy_ .idToServant(oid, true); if (servant == null) throw new org.omg.PortableServer.POAPackage.ObjectNotActive(); return servant; } public org.omg.CORBA.Object id_to_reference(byte[] oid) throws org.omg.PortableServer.POAPackage.ObjectNotActive, org.omg.PortableServer.POAPackage.WrongPolicy { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } // Requires the RETAIN policy // if (policies_.servantRetentionPolicy() != org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN) throw new org.omg.PortableServer.POAPackage.WrongPolicy(); org.omg.PortableServer.Servant servant = servantLocationStrategy_ .idToServant(oid, false); if (servant == null) throw new org.omg.PortableServer.POAPackage.ObjectNotActive(); String intf = servant._all_interfaces(this, oid)[0]; return ort().make_object(intf, oid); } public byte[] id() { if (poaControl_.getDestroyed()) { throw new org.omg.CORBA.OBJECT_NOT_EXIST("POA " + name_ + " has been destroyed"); } return adapterId_; } // ---------------------------------------------------------------------- // Yoko specific functions // ---------------------------------------------------------------------- public void _OB_preinvoke(String op, byte[] oid, org.omg.PortableServer.Servant servant, java.lang.Object cookie, org.apache.yoko.orb.OCI.TransportInfo info) { // // preinvoke the servant location strategy // servantLocationStrategy_.preinvoke(oid); // // Setup the OCI::Current context // ociCurrent_._OB_preinvoke(info); // // Setup the PortableServer::Current context // poaCurrent_._OB_preinvoke(this, servant, op, oid, cookie); // // Depending on the synchronization policy we have to lock a // variety of mutexes. // // TODO: DUMP THIS IF POSSIBLE // switch (policies_.synchronizationPolicy().value()) { case SynchronizationPolicyValue._NO_SYNCHRONIZATION: break; case SynchronizationPolicyValue._SYNCHRONIZE_ON_POA: poaSyncMutex_.lock(); break; case SynchronizationPolicyValue._SYNCHRONIZE_ON_ORB: orbInstance_.getORBSyncMutex().lock(); break; } } public void _OB_postinvoke() { byte[] oid = poaCurrent_._OB_getObjectId(); String op = poaCurrent_._OB_getOp(); org.omg.PortableServer.Servant servant = poaCurrent_._OB_getServant(); java.lang.Object cookie = poaCurrent_._OB_getCookie(); // // Depending on the synchronization policy we have to unlock a // variety of mutexes. Note that we have to do this before // calling postinvoke else we might operation on a destroyed // servant. // switch (policies_.synchronizationPolicy().value()) { case SynchronizationPolicyValue._NO_SYNCHRONIZATION: break; case SynchronizationPolicyValue._SYNCHRONIZE_ON_POA: poaSyncMutex_.unlock(); break; case SynchronizationPolicyValue._SYNCHRONIZE_ON_ORB: orbInstance_.getORBSyncMutex().unlock(); break; } // // Clean up the PortableServant::Current // poaCurrent_._OB_postinvoke(); // // Clean up the OCI:Current // ociCurrent_._OB_postinvoke(); // // postinvoke the servant location strategy // servantLocationStrategy_.postinvoke(oid, this, op, cookie, servant); } void _OB_locateServant(byte[] oid) throws org.apache.yoko.orb.OB.LocationForward { org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookieHolder = new org.omg.PortableServer.ServantLocatorPackage.CookieHolder(); String op = "_locate"; org.omg.PortableServer.Servant servant = servantLocationStrategy_ .locate(oid, this, op, cookieHolder); if (servant == null) throw new org.omg.CORBA.OBJECT_NOT_EXIST( org.apache.yoko.orb.OB.MinorCodes .describeObjectNotExist(org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch), org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); servantLocationStrategy_.preinvoke(oid); servantLocationStrategy_.postinvoke(oid, this, op, cookieHolder.value, servant); } // // Create the upcall object for a method invocation // org.apache.yoko.orb.OB.Upcall _OB_createUpcall(byte[] oid, org.apache.yoko.orb.OB.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) throws org.apache.yoko.orb.OB.LocationForward { org.apache.yoko.orb.OB.Upcall upcall = null; // // Increment the outstanding request count // if (poaControl_.incrementRequestCount()) { try { // // Create the upcall object // if (policies_.interceptorCallPolicy()) { org.apache.yoko.orb.OB.PIManager piManager = orbInstance_ .getPIManager(); if (piManager.haveServerInterceptors()) { org.apache.yoko.orb.OB.PIUpcall piUpcall = new org.apache.yoko.orb.OB.PIUpcall( orbInstance_, upcallReturn, profileInfo, transportInfo, requestId, op, in, requestSCL, piManager); upcall = piUpcall; // // Call the receive_request_service_contexts // interception point // piUpcall.receiveRequestServiceContexts(rawPolicies_, adapterId_, oid, adapterTemplate_); piUpcall.contextSwitch(); } else { upcall = new org.apache.yoko.orb.OB.Upcall( orbInstance_, upcallReturn, profileInfo, transportInfo, requestId, op, in, requestSCL); } } else { upcall = new org.apache.yoko.orb.OB.Upcall(orbInstance_, upcallReturn, profileInfo, transportInfo, requestId, op, in, requestSCL); } org.apache.yoko.orb.OB.DispatchRequest_impl dispatchRequestImpl = new org.apache.yoko.orb.OB.DispatchRequest_impl( this, oid, upcall); upcall.setDispatchInfo(dispatchRequestImpl, dispatchStrategy_); } catch (org.omg.CORBA.SystemException ex) { upcall.setSystemException(ex); _OB_decrementRequestCount(); } catch (org.apache.yoko.orb.OB.LocationForward ex) { upcall.setLocationForward(ex.ior, ex.perm); _OB_decrementRequestCount(); } } // // If this POA has a BidirPolicy set to BOTH and we have // received some listening points in the SCL (which implies that // the client has the BidirPolicy as well), then we must make // sure to map these in the transportInfo structure // if (upcall != null) _OB_handleBidirSCL(transportInfo, requestSCL); return upcall; } // // Dispatch a method invocation // public void _OB_dispatch(byte[] oid, org.apache.yoko.orb.OB.Upcall upcall) { String op = upcall.operation(); // // Notify the PIUpcall about a potential change in thread // context. This has to be done before the servant is located // since PICurrent information has to be available in servant // locators. // upcall.contextSwitch(); try { // // Locating a servant can throw LocationForward and // SystemException errors // org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookieHolder = new org.omg.PortableServer.ServantLocatorPackage.CookieHolder(); org.omg.PortableServer.Servant servant = servantLocationStrategy_ .locate(oid, this, op, cookieHolder); // // If there is a servant then dispatch the request // if (servant != null) { org.apache.yoko.orb.OCI.TransportInfo transportInfo = upcall .transportInfo(); // // Do any pre invocation stuff // _OB_preinvoke(op, oid, servant, cookieHolder.value, transportInfo); // // The Upcall may call _OB_postinvoke // upcall.setServantAndPOA(servant, this); // // Dispatch the request // try { ServantDispatcher dispatcher = new ServantDispatcher( upcall, servant); dispatcher.dispatch(); } finally { // // If postinvoke() hasn't been called, then do it now, // since it may raise an exception that must be returned // to the client // if (!upcall.postinvokeCalled()) { _OB_postinvoke(); // May raise SystemException } } } else if (op.equals("_non_existent") || op.equals("_not_existent")) { upcall.preUnmarshal(); upcall.postUnmarshal(); upcall.postinvoke(); org.omg.CORBA.portable.OutputStream out = upcall.preMarshal(); out.write_boolean(true); upcall.postMarshal(); } else { upcall .setSystemException(new org.omg.CORBA.OBJECT_NOT_EXIST( org.apache.yoko.orb.OB.MinorCodes .describeObjectNotExist(org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch), org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO)); } } catch (org.apache.yoko.orb.OB.LocationForward ex) { upcall.setLocationForward(ex.ior, ex.perm); } /* * This can't happen in Java catch(org.omg.CORBA.UserException ex) { * upcall.setUserException(ex); } */ catch (org.omg.CORBA.SystemException ex) { upcall.setSystemException(ex); } catch (Exception ex) { handleUnknownException(upcall, ex); } // // Java only // // If the skeleton has marshalled a user exception, it is now // safe to call endUserException // if (upcall.userException()) upcall.endUserException(); // // Decrement the outstanding request count // _OB_decrementRequestCount(); } DirectServant _OB_getDirectServant(byte[] oid, org.apache.yoko.orb.OB.RefCountPolicyList policies) throws org.apache.yoko.orb.OB.LocationForward { return servantLocationStrategy_.createDirectStubImpl(this, oid, policies); } public org.apache.yoko.orb.PortableServer.Current_impl _OB_POACurrent() { return poaCurrent_; } public void _OB_removeDirectServant(byte[] oid, DirectServant directServant) { servantLocationStrategy_.removeDirectStubImpl(oid, directServant); } // // Determine if this POA matches the provided object key // boolean _OB_poaMatches(org.apache.yoko.orb.OB.ObjectKeyData data, boolean full) { if (full) { // // Check server id // if (!data.serverId.equals(serverId_)) return false; // // If the length is incorrect, return false // if (data.poaId.length != poaId_.length) return false; // // Check each name // for (int i = 0; i < data.poaId.length; ++i) if (!data.poaId[i].equals(poaId_[i])) return false; } // // Is the POA persistent? If so then the ObjectKeyData must be // persistent. // if (policies_.lifespanPolicy() == org.omg.PortableServer.LifespanPolicyValue.PERSISTENT) return data.persistent; // // Otherwise this POA is transient. The ObjectKeyData must be // transient, and the POA create times must be the same. // if (data.persistent) return false; return data.createTime == poaCreateTime_; } // // Increment the outstanding number of requests // public boolean _OB_incrementRequestCount() { return poaControl_.incrementRequestCount(); } // // Decrement the outstanding number of requests // public void _OB_decrementRequestCount() { if (poaControl_.decrementRequestCount()) { completeDestroy(); } } // // Wait for all pending requests to terminate // public void _OB_waitPendingRequests() { poaControl_.waitPendingRequests(); } // // Get the ORBInstance object // public org.apache.yoko.orb.OB.ORBInstance _OB_ORBInstance() { return orbInstance_; } // // Add the policy factory for the POA Policies // public void _OB_addPolicyFactory() { org.apache.yoko.orb.OB.PolicyFactoryManager pfm = orbInstance_ .getPolicyFactoryManager(); org.omg.PortableInterceptor.PolicyFactory factory = new org.apache.yoko.orb.PortableInterceptor.POAPolicyFactory_impl(); pfm.registerPolicyFactory( org.omg.PortableServer.THREAD_POLICY_ID.value, factory, true); pfm.registerPolicyFactory( org.omg.PortableServer.LIFESPAN_POLICY_ID.value, factory, true); pfm.registerPolicyFactory( org.omg.PortableServer.ID_UNIQUENESS_POLICY_ID.value, factory, true); pfm.registerPolicyFactory( org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID.value, factory, true); pfm.registerPolicyFactory( org.omg.PortableServer.IMPLICIT_ACTIVATION_POLICY_ID.value, factory, true); pfm.registerPolicyFactory( org.omg.PortableServer.SERVANT_RETENTION_POLICY_ID.value, factory, true); pfm.registerPolicyFactory( org.omg.PortableServer.REQUEST_PROCESSING_POLICY_ID.value, factory, true); pfm.registerPolicyFactory(SYNCHRONIZATION_POLICY_ID.value, factory, true); pfm.registerPolicyFactory(DISPATCH_STRATEGY_POLICY_ID.value, factory, true); pfm.registerPolicyFactory(INTERCEPTOR_CALL_POLICY_ID.value, factory, true); } public void _OB_validateManagerState() { POAManager_impl m = (POAManager_impl) manager_; m._OB_validateState(); } public void _OB_etherealize(POAManager_impl manager) { // // Recursively etherealize children's POA // java.util.Enumeration e = children_.elements(); while (e.hasMoreElements()) { org.apache.yoko.orb.OBPortableServer.POA_impl child = (org.apache.yoko.orb.OBPortableServer.POA_impl) e .nextElement(); child._OB_etherealize(manager); } // // Eterealize our servants if the POA is assocatied with the // POAManager passed in argument. // if (manager == manager_) { servantLocationStrategy_.etherealize(this); } } public void _OB_destroy(boolean etherealize, boolean waitForCompletion, java.util.Vector templates) { logger.fine("Destroying POA " + name_); if (poaControl_.getDestroyed()) { // this is not an error on other ORBS. return; } // // If waitForCompletion is TRUE and the current thread is in // an invocation context dispatched from some POA belonging to // the same ORB as this POA, the BAD_INV_ORDER exception is // raised and POA destruction does not occur. // if (waitForCompletion && poaCurrent_._OB_inUpcall()) { try { POA_impl p = (POA_impl) poaCurrent_.get_POA(); if (p._OB_ORBInstance() == orbInstance_) { throw new org.omg.CORBA.BAD_INV_ORDER( "Invocation in progress"); } } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { } } // // Add our primary template to the template sequence to return to // our parent. If templates is null then destroy() was called directly // on this POA. // if (templates != null) { templates.addElement(adapter_template()); callAdapterStateChange_ = false; } // // Mark the POA as destroy pending. Only one thread will // continue. All others will wait (if waitForCompletion is // true) until the POA destruction is complete. // if (poaControl_.markDestroyPending(etherealize, waitForCompletion)) { // // Recursively destroy all children // java.util.Enumeration e = children_.elements(); while (e.hasMoreElements()) { org.apache.yoko.orb.OBPortableServer.POA_impl child = (org.apache.yoko.orb.OBPortableServer.POA_impl) e .nextElement(); if (child != null) { if (templates == null) child._OB_destroy(etherealize, waitForCompletion, childTemplates_); else child._OB_destroy(etherealize, waitForCompletion, templates); } } // // If waitForCompletion is FALSE, the destroy operation // destroys the POA and its children but waits neither for // active requests to complete nor for etherealization to // occur. If destroy is called multiple times before // destruction is complete (because there are active // requests), the etherealize_objects parameter applies // only to the first call of destroy. Subsequent calls // with conflicting etherealize_objects settings use the // value of etherealize_objects from the first call. The // waitForCompletion parameter is handled as defined above // for each individual call (some callers may choose to // block, while others may not). // // We only return if there are outstanding requests. In // this case when the last outstanding request is // completed then destruction of the the POA will // complete. // if (!waitForCompletion && poaControl_.hasPendingRequests()) { return; } completeDestroy(); } } private void _OB_handleBidirSCL( org.apache.yoko.orb.OCI.TransportInfo transportInfo, org.omg.IOP.ServiceContext[] contexts) { if (policies_.bidirPolicy() != org.omg.BiDirPolicy.BOTH.value) { return; } if (transportInfo != null) { transportInfo.handle_service_contexts(contexts); } } }
6,844
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/OBPortableServer/ServantActivatorStrategy.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.OBPortableServer; // // Strategy for ServantActivators // class ServantActivatorStrategy implements ServantManagerStrategy { // // The servant activator // org.omg.PortableServer.ServantActivator servantActivator_; synchronized public void destroy() { servantActivator_ = null; } synchronized public void setServantManager( org.omg.PortableServer.ServantManager manager) { // // Attempting to set the servant manager after one has already // been set will result in the BAD_INV_ORDER exception being // raised. // if (servantActivator_ != null) throw new org.omg.CORBA.BAD_INV_ORDER( org.apache.yoko.orb.OB.MinorCodes .describeBadInvOrder(org.apache.yoko.orb.OB.MinorCodes.MinorServantManagerAlreadySet), org.apache.yoko.orb.OB.MinorCodes.MinorServantManagerAlreadySet, org.omg.CORBA.CompletionStatus.COMPLETED_NO); try { servantActivator_ = org.omg.PortableServer.ServantActivatorHelper .narrow(manager); } catch (org.omg.CORBA.BAD_PARAM ex) { } if (servantActivator_ == null) { throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager), org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } } synchronized public org.omg.PortableServer.ServantManager getServantManager() { return servantActivator_; } // // Note that the synchronization in these methods ensures that // concurrent calls to the incarnate and etherealize do not occur // synchronized public org.omg.PortableServer.Servant incarnate(byte[] oid, org.omg.PortableServer.POA poa) throws org.apache.yoko.orb.OB.LocationForward { // // If no servant manager has been associated with the POA, // OBJ_ADAPTER is raised // if (servantActivator_ == null) throw new org.omg.CORBA.BAD_INV_ORDER( org.apache.yoko.orb.OB.MinorCodes .describeBadInvOrder(org.apache.yoko.orb.OB.MinorCodes.MinorServantManagerAlreadySet), org.apache.yoko.orb.OB.MinorCodes.MinorServantManagerAlreadySet, org.omg.CORBA.CompletionStatus.COMPLETED_NO); org.omg.PortableServer.Servant servant; try { servant = servantActivator_.incarnate(oid, poa); } catch (org.omg.PortableServer.ForwardRequest ex) { org.apache.yoko.orb.CORBA.Delegate p = (org.apache.yoko.orb.CORBA.Delegate) (((org.omg.CORBA.portable.ObjectImpl) ex.forward_reference) ._get_delegate()); org.omg.IOP.IOR ior = p._OB_IOR(); throw new org.apache.yoko.orb.OB.LocationForward(ior, false); } // // 11-23: // // If a ServantManager returns a null Servant (or the // equivalent in a language mapping) as the result of an // incarnate() or preinvoke() operation, the POA will return // the OBJ_ADAPTER system exception as the result of the // request. // if (servant == null) throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorServantNotFound), org.apache.yoko.orb.OB.MinorCodes.MinorServantNotFound, org.omg.CORBA.CompletionStatus.COMPLETED_NO); return servant; } synchronized public void etherealize(byte[] oid, org.omg.PortableServer.POA poa, org.omg.PortableServer.Servant servant, boolean cleanup, boolean remaining) { if (servantActivator_ != null) { try { servantActivator_.etherealize(oid, poa, servant, cleanup, remaining); } catch (org.omg.CORBA.SystemException ex) { // Ignore } } } }
6,845
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/OBPortableServer/SynchronizationPolicyValueHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicyValue:1.0 // final public class SynchronizationPolicyValueHelper { public static void insert(org.omg.CORBA.Any any, SynchronizationPolicyValue val) { org.omg.CORBA.portable.OutputStream out = any.create_output_stream(); write(out, val); any.read_value(out.create_input_stream(), type()); } public static SynchronizationPolicyValue 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(); String[] members = new String[3]; members[0] = "NO_SYNCHRONIZATION"; members[1] = "SYNCHRONIZE_ON_POA"; members[2] = "SYNCHRONIZE_ON_ORB"; typeCode_ = orb.create_enum_tc(id(), "SynchronizationPolicyValue", members); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicyValue:1.0"; } public static SynchronizationPolicyValue read(org.omg.CORBA.portable.InputStream in) { SynchronizationPolicyValue _ob_v; _ob_v = SynchronizationPolicyValue.from_int(in.read_ulong()); return _ob_v; } public static void write(org.omg.CORBA.portable.OutputStream out, SynchronizationPolicyValue val) { out.write_ulong(val.value()); } }
6,846
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/OBPortableServer/ServantLocatorStrategy.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.OBPortableServer; // // Strategy for ServantActivators // class ServantLocatorStrategy implements ServantManagerStrategy { // // The ORBInstance // private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // // The servant locator // private org.omg.PortableServer.ServantLocator servantLocator_; public ServantLocatorStrategy(org.apache.yoko.orb.OB.ORBInstance orbInstance) { orbInstance_ = orbInstance; } synchronized public void destroy() { servantLocator_ = null; } synchronized public void setServantManager( org.omg.PortableServer.ServantManager manager) { // // Attempting to set the servant manager after one has already // been set will result in the BAD_INV_ORDER exception being // raised. // if (servantLocator_ != null) { throw new org.omg.CORBA.BAD_INV_ORDER( org.apache.yoko.orb.OB.MinorCodes .describeBadInvOrder(org.apache.yoko.orb.OB.MinorCodes.MinorServantManagerAlreadySet), org.apache.yoko.orb.OB.MinorCodes.MinorServantManagerAlreadySet, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } try { servantLocator_ = org.omg.PortableServer.ServantLocatorHelper .narrow(manager); } catch (org.omg.CORBA.BAD_PARAM ex) { } if (servantLocator_ == null) { throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager), org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } } synchronized public org.omg.PortableServer.ServantManager getServantManager() { return servantLocator_; } public org.omg.PortableServer.Servant preinvoke(byte[] oid, org.omg.PortableServer.POA poa, String op, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) throws org.apache.yoko.orb.OB.LocationForward { org.omg.PortableServer.ServantLocator locator; synchronized (this) { // // If no servant manager has been associated with the POA, // OBJ_ADAPTER is raised // if (servantLocator_ == null) throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager), org.apache.yoko.orb.OB.MinorCodes.MinorNoServantManager, org.omg.CORBA.CompletionStatus.COMPLETED_NO); locator = servantLocator_; } org.omg.PortableServer.Servant servant; try { servant = locator.preinvoke(oid, poa, op, cookie); } catch (org.omg.PortableServer.ForwardRequest ex) { org.apache.yoko.orb.CORBA.Delegate p = (org.apache.yoko.orb.CORBA.Delegate) (((org.omg.CORBA.portable.ObjectImpl) ex.forward_reference) ._get_delegate()); org.omg.IOP.IOR ior = p._OB_IOR(); throw new org.apache.yoko.orb.OB.LocationForward(ior, false); } // // 11-23: // // If a ServantManager returns a null Servant (or the // equivalent in a language mapping) as the result of an // incarnate() or preinvoke() operation, the POA will return // the OBJ_ADAPTER system exception as the result of the // request. // if (servant == null) { throw new org.omg.CORBA.OBJ_ADAPTER( org.apache.yoko.orb.OB.MinorCodes .describeObjAdapter(org.apache.yoko.orb.OB.MinorCodes.MinorServantNotFound), org.apache.yoko.orb.OB.MinorCodes.MinorServantNotFound, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } // // In Java, the servant needs to be associated with the ORB // (i.e., to have a delegate) // ((org.omg.CORBA_2_3.ORB) orbInstance_.getORB()).set_delegate(servant); return servant; } public void postinvoke(byte[] oid, org.omg.PortableServer.POA poa, String op, java.lang.Object cookie, org.omg.PortableServer.Servant servant) { org.omg.PortableServer.ServantLocator locator; synchronized (this) { if (servantLocator_ == null) { return; } locator = servantLocator_; } locator.postinvoke(oid, poa, op, cookie, servant); } }
6,847
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/OBPortableServer/POA.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POA:1.0 // /** * * This interface is a proprietary extension to the standard POA. * * @see PortableServer::POAManager * **/ public interface POA extends POAOperations, org.omg.PortableServer.POA { }
6,848
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/OBPortableServer/AcceptorConfigSeqHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfigSeq:1.0 // final public class AcceptorConfigSeqHolder implements org.omg.CORBA.portable.Streamable { public AcceptorConfig[] value; public AcceptorConfigSeqHolder() { } public AcceptorConfigSeqHolder(AcceptorConfig[] initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = AcceptorConfigSeqHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { AcceptorConfigSeqHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return AcceptorConfigSeqHelper.type(); } }
6,849
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/OBPortableServer/EndpointConfigurationPolicyHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/EndpointConfigurationPolicy:1.0 // final public class EndpointConfigurationPolicyHolder implements org.omg.CORBA.portable.Streamable { public EndpointConfigurationPolicy value; public EndpointConfigurationPolicyHolder() { } public EndpointConfigurationPolicyHolder(EndpointConfigurationPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = EndpointConfigurationPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { EndpointConfigurationPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return EndpointConfigurationPolicyHelper.type(); } }
6,850
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/OBPortableServer/SynchronizationPolicy.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicy:1.0 // /** * * The synchronization policy. This policy controls the method dispatch * synchronization policy. * * @see SynchronizationPolicyValue * **/ public interface SynchronizationPolicy extends SynchronizationPolicyOperations, org.omg.CORBA.Policy { }
6,851
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/OBPortableServer/POAHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POA:1.0 // final public class POAHelper { public static void insert(org.omg.CORBA.Any any, POA val) { any.insert_Object(val, type()); } public static POA 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(), "POA"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/POA:1.0"; } public static POA 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, POA 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 POA narrow(org.omg.CORBA.Object val) { try { return (POA)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,852
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/OBPortableServer/AcceptorConfig.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfig:1.0 // /** * * Acceptor configuration information. * * @member id The plugin id. * * @member params The configuration parameters. * **/ final public class AcceptorConfig implements org.omg.CORBA.portable.IDLEntity { private static final String _ob_id = "IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfig:1.0"; public AcceptorConfig() { } public AcceptorConfig(String id, String[] params) { this.id = id; this.params = params; } public String id; public String[] params; }
6,853
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/OBPortableServer/DispatchStrategyPolicyHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/DispatchStrategyPolicy:1.0 // final public class DispatchStrategyPolicyHelper { public static void insert(org.omg.CORBA.Any any, DispatchStrategyPolicy val) { any.insert_Object(val, type()); } public static DispatchStrategyPolicy 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(), "DispatchStrategyPolicy"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/DispatchStrategyPolicy:1.0"; } public static DispatchStrategyPolicy 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, DispatchStrategyPolicy 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 DispatchStrategyPolicy narrow(org.omg.CORBA.Object val) { try { return (DispatchStrategyPolicy)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,854
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/OBPortableServer/COMMUNICATIONS_CONCURRENCY_POLICY_THREADED.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/COMMUNICATIONS_CONCURRENCY_POLICY_THREADED:1.0 // /** * * The <code>COMMUNICATIONS_CONCURRENCY_POLICY_THREADED</code> * CommunicationsConcurrencyPolicy value. * **/ public interface COMMUNICATIONS_CONCURRENCY_POLICY_THREADED { short value = (short)(1L); }
6,855
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/OBPortableServer/InterceptorCallPolicy.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/InterceptorCallPolicy:1.0 // /** * * The interceptor call policy. This policy controls whether the * server-side interceptors are called for a particular POA. * **/ public interface InterceptorCallPolicy extends InterceptorCallPolicyOperations, org.omg.CORBA.Policy { }
6,856
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/OBPortableServer/InterceptorCallPolicyOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/InterceptorCallPolicy:1.0 // /** * * The interceptor call policy. This policy controls whether the * server-side interceptors are called for a particular POA. * **/ public interface InterceptorCallPolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/InterceptorCallPolicy/value:1.0 // /** * * The InterceptorCallPolicy value. If a POA has an * <code>InterceptorCallPolicy</code> set and <code>value</code> is * <code>FALSE</code> then any installed server-side interceptors are * not called for requests on this POA. Otherwise, interceptors are * called for each request. The default value is <code>TRUE</code>. * **/ boolean value(); }
6,857
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/OBPortableServer/POAManagerFactory.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory:1.0 // /** * * This interface is a proprietary extension of the standard * POAManagerFactory. * * @see PortableServer::POAManagerFactory * **/ public interface POAManagerFactory extends POAManagerFactoryOperations, org.omg.PortableServer.POAManagerFactory { }
6,858
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/OBPortableServer/DispatchStrategyPolicy.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/DispatchStrategyPolicy:1.0 // /** * * The dispatch strategy policy. This policy controls the method * dispatch strategy. * * @see OB::DispatchStrategy * **/ public interface DispatchStrategyPolicy extends DispatchStrategyPolicyOperations, org.omg.CORBA.Policy { }
6,859
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/OBPortableServer/DispatchStrategyPolicyHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/DispatchStrategyPolicy:1.0 // final public class DispatchStrategyPolicyHolder implements org.omg.CORBA.portable.Streamable { public DispatchStrategyPolicy value; public DispatchStrategyPolicyHolder() { } public DispatchStrategyPolicyHolder(DispatchStrategyPolicy initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = DispatchStrategyPolicyHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { DispatchStrategyPolicyHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return DispatchStrategyPolicyHelper.type(); } }
6,860
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/OBPortableServer/SynchronizationPolicy_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.OBPortableServer; import org.apache.yoko.orb.OBPortableServer.SYNCHRONIZATION_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.SynchronizationPolicy; import org.apache.yoko.orb.OBPortableServer.SynchronizationPolicyValue; public final class SynchronizationPolicy_impl extends org.omg.CORBA.LocalObject implements SynchronizationPolicy { private SynchronizationPolicyValue value_; public SynchronizationPolicy_impl(SynchronizationPolicyValue value) { value_ = value; } public SynchronizationPolicyValue value() { return value_; } public int policy_type() { return SYNCHRONIZATION_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,861
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/OBPortableServer/IdGenerationStrategy.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.OBPortableServer; // // This abstract class represents an id generation strategy // interface IdGenerationStrategy { // // Create a new ObjectId // byte[] createId() throws org.omg.PortableServer.POAPackage.WrongPolicy; // // Is an ObjectId valid? // boolean isValid(byte[] oid); }
6,862
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/OBPortableServer/DISPATCH_STRATEGY_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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/DISPATCH_STRATEGY_POLICY_ID:1.0 // /** * * This policy type identifies the dispatch strategy policy. * **/ public interface DISPATCH_STRATEGY_POLICY_ID { int value = (int)(1330577666L); }
6,863
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/OBPortableServer/POAHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POA:1.0 // final public class POAHolder implements org.omg.CORBA.portable.Streamable { public POA value; public POAHolder() { } public POAHolder(POA initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = POAHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { POAHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return POAHelper.type(); } }
6,864
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/OBPortableServer/POAOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POA:1.0 // /** * * This interface is a proprietary extension to the standard POA. * * @see PortableServer::POAManager * **/ public interface POAOperations extends org.omg.PortableServer.POAOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/POA/the_policies:1.0 // /** * * Determine the policies that this POA was created with * **/ org.omg.CORBA.Policy[] the_policies(); // // IDL:orb.yoko.apache.org/OBPortableServer/POA/the_dispatch_strategy:1.0 // /** * * Determine the DispatchStrategy in use by this POA * **/ org.apache.yoko.orb.OB.DispatchStrategy the_dispatch_strategy(); // // IDL:orb.yoko.apache.org/OBPortableServer/POA/adapter_template:1.0 // /** * * Retrieve the Primary Object Reference Template * **/ org.omg.PortableInterceptor.ObjectReferenceTemplate adapter_template(); // // IDL:orb.yoko.apache.org/OBPortableServer/POA/current_factory:1.0 // /** * * Retrieve the Secondary Object Reference Template * **/ org.omg.PortableInterceptor.ObjectReferenceFactory current_factory(); // // IDL:orb.yoko.apache.org/OBPortableServer/POA/the_ORB:1.0 // /** * * Retrieve the ORB on which the POA was created * **/ org.omg.CORBA.ORB the_ORB(); // // IDL:orb.yoko.apache.org/OBPortableServer/POA/create_synchronization_policy:1.0 // /** * * Create a synchronization policy * * @param value The SynchronizationPolicyValue * * @return A new SynchronizationPolicy * **/ SynchronizationPolicy create_synchronization_policy(SynchronizationPolicyValue value); // // IDL:orb.yoko.apache.org/OBPortableServer/POA/create_dispatch_strategy_policy:1.0 // /** * * Create a dispatch strategy policy * * @param value The DispatchStrategyPolicy * * @return A new DisptachStrategy * **/ DispatchStrategyPolicy create_dispatch_strategy_policy(org.apache.yoko.orb.OB.DispatchStrategy value); }
6,865
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/OBPortableServer/SystemIdGenerationStrategy.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.OBPortableServer; // // Create a new system generated object id. This is used for SYSTEM_ID // POA. It is necessary to identify ObjectId as belonging to a // SYSTEM_ID POA to prevent the user from calling // active_object_with_id and create_reference_with_id with ObjectId's // not generated from this POA. // // Our system generated object-id's are 12 octet: // // The first 4 bytes are magic (0xcafebabe) // The next 4 bytes are the creation timestamp of the POA // The next 4 bytes is a running counter. // class SystemIdGenerationStrategy implements IdGenerationStrategy { int id_; // // Is the POA persistent? // boolean persistent_; // // The create time // int createTime_; private static final byte[] SystemGeneratedMagic = { (byte) 0xca, (byte) 0xfe, (byte) 0xba, (byte) 0xbe }; SystemIdGenerationStrategy(boolean persistent) { id_ = 0; persistent_ = persistent; createTime_ = (int) (System.currentTimeMillis() / 1000); } public byte[] createId() throws org.omg.PortableServer.POAPackage.WrongPolicy { byte[] oid = new byte[12]; int pos = 0; // // Copy the magic number // System.arraycopy(SystemGeneratedMagic, 0, oid, pos, 4); pos += 4; // // Copy the POA create time // oid[pos++] = (byte) (createTime_ >>> 24); oid[pos++] = (byte) (createTime_ >>> 16); oid[pos++] = (byte) (createTime_ >>> 8); oid[pos++] = (byte) createTime_; // // Copy the system id // int currId; synchronized (this) { currId = id_++; } oid[pos++] = (byte) (currId >>> 24); oid[pos++] = (byte) (currId >>> 16); oid[pos++] = (byte) (currId >>> 8); oid[pos++] = (byte) currId; org.apache.yoko.orb.OB.Assert._OB_assert(pos == oid.length); return oid; } public boolean isValid(byte[] oid) { int pos = 0; for (pos = 0; pos < SystemGeneratedMagic.length; pos++) if (oid[pos] != SystemGeneratedMagic[pos]) return false; int t = (oid[pos++] << 24) | ((oid[pos++] << 16) & 0xff0000) | ((oid[pos++] << 8) & 0xff00) | (oid[pos++] & 0xff); if (persistent_) { if (t > createTime_) return false; } else if (createTime_ != t) return false; return true; } }
6,866
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/OBPortableServer/ServantLocationStrategyFactory.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.OBPortableServer; class ServantLocationStrategyFactory { static public ServantLocationStrategy createServantLocationStrategy( org.apache.yoko.orb.OBPortableServer.POAPolicies policies, org.apache.yoko.orb.OB.ORBInstance orbInstance) { if (policies.requestProcessingPolicy() == org.omg.PortableServer.RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY) return new ActiveObjectOnlyStrategy(policies, orbInstance); ServantLocatorStrategy servantLocator = null; ServantActivatorStrategy servantActivator = null; DefaultServantHolder defaultServant = null; if (policies.requestProcessingPolicy() == org.omg.PortableServer.RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) defaultServant = new DefaultServantHolder(); if (policies.requestProcessingPolicy() == org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER) { if (policies.servantRetentionPolicy() == org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN) { servantActivator = new ServantActivatorStrategy(); } else { servantLocator = new ServantLocatorStrategy(orbInstance); } } if (policies.servantRetentionPolicy() == org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN) return new RetainStrategy(policies, orbInstance, servantActivator, defaultServant); // NON_RETAIN return new NonRetainStrategy(servantLocator, defaultServant); } }
6,867
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/OBPortableServer/GIOP_VERSION_POLICY_1_2.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/GIOP_VERSION_POLICY_1_2:1.0 // /** * * The <code>GIOP_VERSION_POLICY_1_2</code> GIOPVersionPolicy value. * **/ public interface GIOP_VERSION_POLICY_1_2 { short value = (short)(2L); }
6,868
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/OBPortableServer/POAOAInterface_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.OBPortableServer; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.OB.IORUtil; // // We don't need any sort of concurrency protection on this class // since its lifecycle is tightly coupled with the POAManager. Once // the POAManager destroys this class it should not be possible for // any further requests to arrive (or any requests in the process of // being dispatched). // final class POAOAInterface_impl extends org.omg.CORBA.LocalObject implements org.apache.yoko.orb.OB.OAInterface { static final Logger logger = Logger.getLogger(POAOAInterface_impl.class.getName()); // // The ORBInstance // private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // // The POAManager implementation // private POAManager_impl poaManager_; // // The boot manager implementation // private org.apache.yoko.orb.OB.BootManager_impl bootManagerImpl_; // // Is the POAOAInterface discarding requests? // private boolean discard_; // ---------------------------------------------------------------------- // Package member implementation // ---------------------------------------------------------------------- POAOAInterface_impl(POAManager_impl poaManager, org.apache.yoko.orb.OB.ORBInstance orbInstance) { poaManager_ = poaManager; orbInstance_ = orbInstance; bootManagerImpl_ = (org.apache.yoko.orb.OB.BootManager_impl) orbInstance .getBootManager(); } // ---------------------------------------------------------------------- // Public member implementation // ---------------------------------------------------------------------- public org.apache.yoko.orb.OB.Upcall createUpcall( org.apache.yoko.orb.OB.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) { org.apache.yoko.orb.OB.Upcall upcall = null; logger.fine("Creating upcall for operation " + op); try { // // If discarding then throw a TRANSIENT exception // if (discard_) { throw new org.omg.CORBA.TRANSIENT( "Requests are being discarded", 0, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } org.apache.yoko.orb.OB.ObjectKeyData data = new org.apache.yoko.orb.OB.ObjectKeyData(); if (org.apache.yoko.orb.OB.ObjectKey.ParseObjectKey(profileInfo.key, data)) { while (true) { // // Locate the POA. This may also throw a TRANSIENT // exception if the POA manager is discarding. // org.omg.PortableServer.POA poa = poaManager_._OB_locatePOA(data); if (poa != null) { logger.fine("Unable to locate POA " + data + " using POAManager " + poaManager_.get_id()); POA_impl poaImpl = (POA_impl) poa; upcall = poaImpl._OB_createUpcall(data.oid, upcallReturn, profileInfo, transportInfo, requestId, op, in, requestSCL); // // If _OB_createUpcall returns a nil Upcall object // then we should retry since that means that the // POA is being destroyed // if (upcall == null) { continue; } } break; } } else if (upcallReturn != null) { logger.fine("Error parsing object key data"); // // Check to see if the BootManager knows of a reference // for the ObjectKey. If so, forward the request. // org.omg.IOP.IOR ior = bootManagerImpl_._OB_locate(profileInfo.key); if (ior != null) { throw new org.apache.yoko.orb.OB.LocationForward(ior, false); } } // // If no upcall has been created then the object simply // doesn't exist // if (upcall == null) { if (op.equals("_non_existent") || op.equals("_not_existent")) { upcall = new org.apache.yoko.orb.OB.Upcall(orbInstance_, upcallReturn, profileInfo, transportInfo, requestId, op, in, requestSCL); upcall.preUnmarshal(); upcall.postUnmarshal(); upcall.postinvoke(); org.omg.CORBA.portable.OutputStream out = upcall.preMarshal(); out.write_boolean(true); upcall.postMarshal(); } else { throw new org.omg.CORBA.OBJECT_NOT_EXIST( org.apache.yoko.orb.OB.MinorCodes .describeObjectNotExist(org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch), org.apache.yoko.orb.OB.MinorCodes.MinorCannotDispatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } } } catch (org.omg.CORBA.SystemException ex) { logger.log(Level.FINE, "System exception creating upcall", ex); upcall = new org.apache.yoko.orb.OB.Upcall(orbInstance_, upcallReturn, profileInfo, transportInfo, requestId, op, in, requestSCL); upcall.setSystemException(ex); } catch (org.apache.yoko.orb.OB.LocationForward ex) { logger.log(Level.FINE, "Location forward request creating upcall.", ex); upcall = new org.apache.yoko.orb.OB.Upcall(orbInstance_, upcallReturn, profileInfo, transportInfo, requestId, op, in, requestSCL); upcall.setLocationForward(ex.ior, ex.perm); } org.apache.yoko.orb.OB.Assert._OB_assert(upcall != null); return upcall; } public int findByKey(byte[] key, org.omg.IOP.IORHolder ior) { org.apache.yoko.orb.OB.ObjectKeyData data = new org.apache.yoko.orb.OB.ObjectKeyData(); if (org.apache.yoko.orb.OB.ObjectKey.ParseObjectKey(key, data)) { try { logger.fine("Locate request for object key " + data); org.omg.PortableServer.POA poa = poaManager_._OB_locatePOA(data); if (poa != null) { POA_impl poaImpl = (POA_impl) poa; poaImpl._OB_locateServant(data.oid); return org.apache.yoko.orb.OB.OAInterface.OBJECT_HERE; } } catch (org.omg.CORBA.SystemException ex) { } catch (org.apache.yoko.orb.OB.LocationForward fwd) { ior.value = fwd.ior; return (fwd.perm) ? org.apache.yoko.orb.OB.OAInterface.OBJECT_FORWARD_PERM : org.apache.yoko.orb.OB.OAInterface.OBJECT_FORWARD; } } else { // // Check to see if the BootManager knows of a reference // for the ObjectKey. // logger.fine("Checking boot manager for object with key " + data); ior.value = bootManagerImpl_._OB_locate(key); if (ior.value != null) { return org.apache.yoko.orb.OB.OAInterface.OBJECT_FORWARD; } } return org.apache.yoko.orb.OB.OAInterface.UNKNOWN_OBJECT; } public org.apache.yoko.orb.OCI.ProfileInfo[] getUsableProfiles( org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] policies) { try { org.apache.yoko.orb.OCI.Acceptor[] acceptors = poaManager_ .get_acceptors(); java.util.Vector seq = new java.util.Vector(); for (int i = 0; i < acceptors.length; i++) { org.apache.yoko.orb.OCI.ProfileInfo[] seq2 = acceptors[i] .get_local_profiles(ior); for (int j = 0; j < seq2.length; j++) seq.addElement(seq2[j]); } org.apache.yoko.orb.OCI.ProfileInfo[] result = new org.apache.yoko.orb.OCI.ProfileInfo[seq .size()]; seq.copyInto(result); return result; } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); return null; } } // // Discard all incoming requests with a TRANSIENT exception // // ASYNC SAFE // public void discard() { discard_ = true; } // // Allow associated POAs to receive requests // public void activate() { discard_ = false; } }
6,869
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/OBPortableServer/CommunicationsConcurrencyPolicy.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/CommunicationsConcurrencyPolicy:1.0 // /** * * Communications Concurrency Policy * **/ public interface CommunicationsConcurrencyPolicy extends CommunicationsConcurrencyPolicyOperations, org.omg.CORBA.Policy { }
6,870
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/OBPortableServer/POAPolicies.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. */ // // This class represents the set of POA policies defined on the // current POA. This class is immutable, and needs no mutex // protection. // package org.apache.yoko.orb.OBPortableServer; import org.apache.yoko.orb.OBPortableServer.DISPATCH_STRATEGY_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.DispatchStrategyPolicy; import org.apache.yoko.orb.OBPortableServer.DispatchStrategyPolicyHelper; import org.apache.yoko.orb.OBPortableServer.INTERCEPTOR_CALL_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.InterceptorCallPolicy; import org.apache.yoko.orb.OBPortableServer.InterceptorCallPolicyHelper; import org.apache.yoko.orb.OBPortableServer.SYNCHRONIZATION_POLICY_ID; import org.apache.yoko.orb.OBPortableServer.SynchronizationPolicy; import org.apache.yoko.orb.OBPortableServer.SynchronizationPolicyHelper; import org.apache.yoko.orb.OBPortableServer.SynchronizationPolicyValue; import org.apache.yoko.orb.OB.ZERO_PORT_POLICY_ID; import org.apache.yoko.orb.OB.ZeroPortPolicy; import org.apache.yoko.orb.OB.ZeroPortPolicyHelper; import org.apache.yoko.orb.OB.ZeroPortPolicyValue; final public class POAPolicies { private boolean interceptorCallPolicyValue_; private SynchronizationPolicyValue synchronizationPolicyValue_; private org.apache.yoko.orb.OB.DispatchStrategy dispatchStrategyPolicyValue_; private boolean zeroPortPolicyValue_; private org.omg.PortableServer.LifespanPolicyValue lifespanPolicyValue_; private org.omg.PortableServer.IdUniquenessPolicyValue idUniquenessPolicyValue_; private org.omg.PortableServer.IdAssignmentPolicyValue idAssignmentPolicyValue_; private org.omg.PortableServer.ImplicitActivationPolicyValue implicitActivationPolicyValue_; private org.omg.PortableServer.ServantRetentionPolicyValue servantRetentionPolicyValue_; private org.omg.PortableServer.RequestProcessingPolicyValue requestProcessingPolicyValue_; private short bidirPolicyValue_; POAPolicies(org.apache.yoko.orb.OB.ORBInstance orbInstance, org.omg.CORBA.Policy[] policies) { // // Set the default policy values // interceptorCallPolicyValue_ = true; synchronizationPolicyValue_ = SynchronizationPolicyValue.NO_SYNCHRONIZATION; zeroPortPolicyValue_ = false; lifespanPolicyValue_ = org.omg.PortableServer.LifespanPolicyValue.TRANSIENT; idUniquenessPolicyValue_ = org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID; idAssignmentPolicyValue_ = org.omg.PortableServer.IdAssignmentPolicyValue.SYSTEM_ID; implicitActivationPolicyValue_ = org.omg.PortableServer.ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION; servantRetentionPolicyValue_ = org.omg.PortableServer.ServantRetentionPolicyValue.RETAIN; requestProcessingPolicyValue_ = org.omg.PortableServer.RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY; dispatchStrategyPolicyValue_ = null; bidirPolicyValue_ = org.omg.BiDirPolicy.BOTH.value; if (policies != null) { for (int i = 0; i < policies.length; ++i) { int policyType = policies[i].policy_type(); if (policyType == org.omg.PortableServer.THREAD_POLICY_ID.value) { org.omg.PortableServer.ThreadPolicy policy = org.omg.PortableServer.ThreadPolicyHelper .narrow(policies[i]); synchronizationPolicyValue_ = (policy.value() == org.omg.PortableServer.ThreadPolicyValue.ORB_CTRL_MODEL) ? SynchronizationPolicyValue.NO_SYNCHRONIZATION : SynchronizationPolicyValue.SYNCHRONIZE_ON_ORB; } else if (policyType == org.omg.PortableServer.LIFESPAN_POLICY_ID.value) { org.omg.PortableServer.LifespanPolicy policy = org.omg.PortableServer.LifespanPolicyHelper .narrow(policies[i]); lifespanPolicyValue_ = policy.value(); } else if (policyType == org.omg.PortableServer.ID_UNIQUENESS_POLICY_ID.value) { org.omg.PortableServer.IdUniquenessPolicy policy = org.omg.PortableServer.IdUniquenessPolicyHelper .narrow(policies[i]); idUniquenessPolicyValue_ = policy.value(); } else if (policyType == org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID.value) { org.omg.PortableServer.IdAssignmentPolicy policy = org.omg.PortableServer.IdAssignmentPolicyHelper .narrow(policies[i]); idAssignmentPolicyValue_ = policy.value(); } else if (policyType == org.omg.PortableServer.IMPLICIT_ACTIVATION_POLICY_ID.value) { org.omg.PortableServer.ImplicitActivationPolicy policy = org.omg.PortableServer.ImplicitActivationPolicyHelper .narrow(policies[i]); implicitActivationPolicyValue_ = policy.value(); } else if (policyType == org.omg.PortableServer.SERVANT_RETENTION_POLICY_ID.value) { org.omg.PortableServer.ServantRetentionPolicy policy = org.omg.PortableServer.ServantRetentionPolicyHelper .narrow(policies[i]); servantRetentionPolicyValue_ = policy.value(); } else if (policyType == org.omg.PortableServer.REQUEST_PROCESSING_POLICY_ID.value) { org.omg.PortableServer.RequestProcessingPolicy policy = org.omg.PortableServer.RequestProcessingPolicyHelper .narrow(policies[i]); requestProcessingPolicyValue_ = policy.value(); } else if (policyType == org.omg.BiDirPolicy.BIDIRECTIONAL_POLICY_TYPE.value) { org.omg.BiDirPolicy.BidirectionalPolicy p = org.omg.BiDirPolicy.BidirectionalPolicyHelper .narrow(policies[i]); bidirPolicyValue_ = p.value(); } // // Yoko proprietary policies // else if (policyType == SYNCHRONIZATION_POLICY_ID.value) { SynchronizationPolicy policy = SynchronizationPolicyHelper .narrow(policies[i]); synchronizationPolicyValue_ = policy.value(); } else if (policyType == DISPATCH_STRATEGY_POLICY_ID.value) { DispatchStrategyPolicy policy = DispatchStrategyPolicyHelper .narrow(policies[i]); dispatchStrategyPolicyValue_ = policy.value(); } else if (policyType == INTERCEPTOR_CALL_POLICY_ID.value) { InterceptorCallPolicy policy = InterceptorCallPolicyHelper .narrow(policies[i]); interceptorCallPolicyValue_ = policy.value(); } else if (policyType == ZERO_PORT_POLICY_ID.value) { ZeroPortPolicy policy = ZeroPortPolicyHelper .narrow(policies[i]); zeroPortPolicyValue_ = policy.value(); } // // Otherwise the policy is not a ORB defined POA policy // } } if (dispatchStrategyPolicyValue_ == null) { org.apache.yoko.orb.OB.DispatchStrategyFactory dsf = orbInstance .getDispatchStrategyFactory(); dispatchStrategyPolicyValue_ = dsf .create_default_dispatch_strategy(); } } public boolean interceptorCallPolicy() { return interceptorCallPolicyValue_; } public boolean zeroPortPolicy() { return zeroPortPolicyValue_; } public SynchronizationPolicyValue synchronizationPolicy() { // TODO: Fix this // if(OBORB_impl.server_conc_model() == // ORBORB_impl.ServerConcModelThreaded) // return org.apache.yoko.orb.OB.SYNCHRONIZE_ON_ORB; return synchronizationPolicyValue_; } public org.apache.yoko.orb.OB.DispatchStrategy dispatchStrategyPolicy() { return dispatchStrategyPolicyValue_; } public org.omg.PortableServer.LifespanPolicyValue lifespanPolicy() { return lifespanPolicyValue_; } public org.omg.PortableServer.IdUniquenessPolicyValue idUniquenessPolicy() { return idUniquenessPolicyValue_; } public org.omg.PortableServer.IdAssignmentPolicyValue idAssignmentPolicy() { return idAssignmentPolicyValue_; } public org.omg.PortableServer.ImplicitActivationPolicyValue implicitActivationPolicy() { return implicitActivationPolicyValue_; } public org.omg.PortableServer.ServantRetentionPolicyValue servantRetentionPolicy() { return servantRetentionPolicyValue_; } public org.omg.PortableServer.RequestProcessingPolicyValue requestProcessingPolicy() { return requestProcessingPolicyValue_; } public short bidirPolicy() { return bidirPolicyValue_; } public org.omg.CORBA.Policy[] recreate() { // // TODO: // // No ThreadPolicy policy appended. The problem is that some // values of SyncPolicy don't map. I guess the real solution // to this is to only create those policies that were // provided. Also, providing both Sync policy and ThreadPolicy // should be invalid. // org.omg.CORBA.Policy[] pl = new org.omg.CORBA.Policy[10]; int i = 0; pl[i++] = new org.apache.yoko.orb.PortableServer.LifespanPolicy_impl( lifespanPolicyValue_); pl[i++] = new org.apache.yoko.orb.PortableServer.IdUniquenessPolicy_impl( idUniquenessPolicyValue_); pl[i++] = new org.apache.yoko.orb.PortableServer.IdAssignmentPolicy_impl( idAssignmentPolicyValue_); pl[i++] = new org.apache.yoko.orb.PortableServer.ImplicitActivationPolicy_impl( implicitActivationPolicyValue_); pl[i++] = new org.apache.yoko.orb.PortableServer.ServantRetentionPolicy_impl( servantRetentionPolicyValue_); pl[i++] = new org.apache.yoko.orb.PortableServer.RequestProcessingPolicy_impl( requestProcessingPolicyValue_); pl[i++] = new SynchronizationPolicy_impl(synchronizationPolicyValue_); pl[i++] = new DispatchStrategyPolicy_impl(dispatchStrategyPolicyValue_); pl[i] = new InterceptorCallPolicy_impl(interceptorCallPolicyValue_); return pl; } }
6,871
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/OBPortableServer/DirectServant.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.OBPortableServer; public class DirectServant extends org.omg.CORBA.portable.ServantObject { // // The POA // private org.apache.yoko.orb.OBPortableServer.POA_impl poa_; // The object ID // private byte[] oid_; // // This flag is true if the servant has been deactivated // private boolean deactivated_; private Object original_servant; public DirectServant(org.apache.yoko.orb.OBPortableServer.POA_impl poa, byte[] oid, java.lang.Object servant) { poa_ = poa; oid_ = oid; deactivated_ = false; this.original_servant = servant; this.servant = servant; if (servant instanceof javax.rmi.CORBA.Tie) { javax.rmi.CORBA.Tie tie = (javax.rmi.CORBA.Tie) servant; this.servant = tie.getTarget(); } } protected void finalize() throws Throwable { // // This object *must* have been deactivated already // org.apache.yoko.orb.OB.Assert._OB_assert(deactivated_); super.finalize(); } public void destroy() { // // An explicit destroy method is needed in Java to force the // removal of this object from the POA's table. Otherwise, // this object will never be garbage collected. // if (!deactivated_) { poa_._OB_removeDirectServant(oid_, this); deactivated_ = true; } } public boolean deactivated() { return deactivated_; } public void deactivate() { deactivated_ = true; } public org.omg.CORBA.portable.ServantObject preinvoke(String op) { // // Validate POA manager state // poa_._OB_validateManagerState(); // // Increment the POA's request count // if (!poa_._OB_incrementRequestCount()) return null; // // Preinvoke // poa_._OB_preinvoke(op, oid_, (org.omg.PortableServer.Servant) original_servant, null, null); return this; } public void postinvoke() { // // Postinvoke // poa_._OB_postinvoke(); // // Decrement the outstanding request count // poa_._OB_decrementRequestCount(); } public boolean locate_request() { try { if (preinvoke("_locate") != null) { postinvoke(); return true; } } catch (org.omg.CORBA.OBJECT_NOT_EXIST ex) { // Fall through } return false; } }
6,872
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/OBPortableServer/COMMUNICATIONS_CONCURRENCY_POLICY_REACTIVE.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/COMMUNICATIONS_CONCURRENCY_POLICY_REACTIVE:1.0 // /** * * The <code>COMMUNICATIONS_CONCURRENCY_POLICY_REACTIVE</code> * CommunicationsConcurrencyPolicy value. * **/ public interface COMMUNICATIONS_CONCURRENCY_POLICY_REACTIVE { short value = (short)(0L); }
6,873
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/OBPortableServer/POAManagerFactoryHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory:1.0 // final public class POAManagerFactoryHelper { public static void insert(org.omg.CORBA.Any any, POAManagerFactory val) { any.insert_Object(val, type()); } public static POAManagerFactory 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(), "POAManagerFactory"); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory:1.0"; } public static POAManagerFactory 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, POAManagerFactory 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 POAManagerFactory narrow(org.omg.CORBA.Object val) { try { return (POAManagerFactory)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,874
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/OBPortableServer/AcceptorConfigHelper.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfig:1.0 // final public class AcceptorConfigHelper { public static void insert(org.omg.CORBA.Any any, AcceptorConfig val) { org.omg.CORBA.portable.OutputStream out = any.create_output_stream(); write(out, val); any.read_value(out.create_input_stream(), type()); } public static AcceptorConfig 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[2]; members[0] = new org.omg.CORBA.StructMember(); members[0].name = "id"; members[0].type = org.apache.yoko.orb.OCI.PluginIdHelper.type(); members[1] = new org.omg.CORBA.StructMember(); members[1].name = "params"; members[1].type = org.apache.yoko.orb.OCI.ParamSeqHelper.type(); typeCode_ = orb.create_struct_tc(id(), "AcceptorConfig", members); } return typeCode_; } public static String id() { return "IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfig:1.0"; } public static AcceptorConfig read(org.omg.CORBA.portable.InputStream in) { AcceptorConfig _ob_v = new AcceptorConfig(); _ob_v.id = org.apache.yoko.orb.OCI.PluginIdHelper.read(in); _ob_v.params = org.apache.yoko.orb.OCI.ParamSeqHelper.read(in); return _ob_v; } public static void write(org.omg.CORBA.portable.OutputStream out, AcceptorConfig val) { org.apache.yoko.orb.OCI.PluginIdHelper.write(out, val.id); org.apache.yoko.orb.OCI.ParamSeqHelper.write(out, val.params); } }
6,875
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/OBPortableServer/AcceptorConfigHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/AcceptorConfig:1.0 // final public class AcceptorConfigHolder implements org.omg.CORBA.portable.Streamable { public AcceptorConfig value; public AcceptorConfigHolder() { } public AcceptorConfigHolder(AcceptorConfig initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = AcceptorConfigHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { AcceptorConfigHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return AcceptorConfigHelper.type(); } }
6,876
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/OBPortableServer/POAManagerFactoryHolder.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/POAManagerFactory:1.0 // final public class POAManagerFactoryHolder implements org.omg.CORBA.portable.Streamable { public POAManagerFactory value; public POAManagerFactoryHolder() { } public POAManagerFactoryHolder(POAManagerFactory initial) { value = initial; } public void _read(org.omg.CORBA.portable.InputStream in) { value = POAManagerFactoryHelper.read(in); } public void _write(org.omg.CORBA.portable.OutputStream out) { POAManagerFactoryHelper.write(out, value); } public org.omg.CORBA.TypeCode _type() { return POAManagerFactoryHelper.type(); } }
6,877
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/OBPortableServer/ENDPOINT_CONFIGURATION_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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/ENDPOINT_CONFIGURATION_POLICY_ID:1.0 // /** * * This policy type identifies the endpoint configuration policy. * **/ public interface ENDPOINT_CONFIGURATION_POLICY_ID { int value = (int)(1330577669L); }
6,878
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/OBPortableServer/ServantManagerStrategy.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.OBPortableServer; interface ServantManagerStrategy { // // Destroy the servant manager strategy // void destroy(); // // Set the servant manager // void setServantManager(org.omg.PortableServer.ServantManager manager); // // Retrieve the servant manager // org.omg.PortableServer.ServantManager getServantManager(); }
6,879
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/OBPortableServer/IdGenerationStrategyFactory.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.OBPortableServer; // // This id generation strategy is for user ids, hence it doesn't do // much // class UserIdGenerationStrategy implements IdGenerationStrategy { public byte[] createId() throws org.omg.PortableServer.POAPackage.WrongPolicy { throw new org.omg.PortableServer.POAPackage.WrongPolicy(); } public boolean isValid(byte[] oid) { return true; } } // // Create the appropriate id generation strategy // public class IdGenerationStrategyFactory { public static IdGenerationStrategy createIdGenerationStrategy( POAPolicies policies) { if (policies.idAssignmentPolicy() == org.omg.PortableServer.IdAssignmentPolicyValue.SYSTEM_ID) return new SystemIdGenerationStrategy( policies.lifespanPolicy() == org.omg.PortableServer.LifespanPolicyValue.PERSISTENT); return new UserIdGenerationStrategy(); } }
6,880
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/OBPortableServer/POANameHasher.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.OBPortableServer; // // Note: We cannot use String[] as a Hashtable key, because // different hashcodes are computed for equivalent string arrays. // final class POANameHasher { private String[] poaId_; private int hashCode_; POANameHasher(String[] poaId) { poaId_ = poaId; hashCode_ = ("").hashCode(); for (int i = 0; i < poaId_.length; i++) hashCode_ ^= poaId_[i].hashCode(); } public int hashCode() { return hashCode_; } public boolean equals(java.lang.Object o) { POANameHasher k = (POANameHasher) o; if (poaId_.length != k.poaId_.length) return false; for (int i = 0; i < poaId_.length; i++) if (!poaId_[i].equals(k.poaId_[i])) return false; return true; } public String toString() { StringBuffer buf = new StringBuffer(); for (int i = 0; i < poaId_.length; i++) { buf.append('/'); buf.append(poaId_[i]); } return buf.toString(); } }
6,881
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/OBPortableServer/GIOPVersionPolicyOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/GIOPVersionPolicy:1.0 // /** * * GIOP Version Policy * **/ public interface GIOPVersionPolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/GIOPVersionPolicy/value:1.0 // /***/ short value(); }
6,882
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/OBPortableServer/SynchronizationPolicyOperations.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.OBPortableServer; // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicy:1.0 // /** * * The synchronization policy. This policy controls the method dispatch * synchronization policy. * * @see SynchronizationPolicyValue * **/ public interface SynchronizationPolicyOperations extends org.omg.CORBA.PolicyOperations { // // IDL:orb.yoko.apache.org/OBPortableServer/SynchronizationPolicy/value:1.0 // /** * * The SynchronizationPolicyValue value. * **/ SynchronizationPolicyValue value(); }
6,883
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/CosNaming/NamingContextBase.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. */ /** * @version $Rev: 553831 $ $Date: 2007-07-06 03:52:10 -0700 (Fri, 06 Jul 2007) $ */ package org.apache.yoko.orb.CosNaming; import java.util.List; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.OB.MinorCodes; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.ORB; import org.omg.CORBA.SystemException; import org.omg.CosNaming.BindingType; import org.omg.CosNaming.BindingTypeHolder; import org.omg.CosNaming.NameComponent; import org.omg.CosNaming.NamingContextHelper; import org.omg.CosNaming.NamingContext; import org.omg.CosNaming.NamingContextExtPOA; import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; import org.omg.CosNaming.NamingContextPackage.AlreadyBound; import org.omg.CosNaming.NamingContextPackage.InvalidName; import org.omg.CosNaming.NamingContextPackage.NotFoundReason; import org.omg.CosNaming.NamingContextPackage.NotFound; import org.omg.PortableServer.POA; public abstract class NamingContextBase extends NamingContextExtPOA { // the real logger backing instance. We use the interface class as the locator protected static final Logger logger = Logger.getLogger(NamingContext.class.getName()); // set of URL characters that don't require escaping when encoded. protected final String nonEscaped = ";/?:@&=+$;-_.!~* ()"; // the orb we're attached to protected ORB orb; // the poa we're associated with protected POA poa; /** * Create a new base NamingContext (super class constructor * for the derived classes). * * @param orb The ORB this is hosted on. * * @exception java.lang.Exception */ public NamingContextBase(ORB orb, POA poa) throws java.lang.Exception { super(); this.orb = orb; this.poa = poa; } /** * Bind an object to a given name. * * @param n An array of NameComponents that are the target name. * The last element in the array is binding name for the * object. The remainder of the array is the path * for resolving the naming context, relative to the * current context. All path contexts must already be * bound in the context tree. * @param obj The object to be bound. * * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound */ public void bind (org.omg.CosNaming.NameComponent[] n, org.omg.CORBA.Object obj) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.AlreadyBound { // perform various name validations validateName(n); logNameComponent("bind() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.bind(subName, obj); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); if (resolveObject(name, type) != null) { throw new AlreadyBound(); } type.value = BindingType.nobject; // ok, this is a new binding, go do it. bindObject(name, obj, type); } } } /** * Rebind an object to a given name. If an object is * already bound with this name, the new object replaces * the bound object's value. If no object has been * bound already, this is the same as a bind operation. * * @param n An array of NameComponents that are the target name. * The last element in the array is binding name for the * object. The remainder of the array is the path * for resolving the naming context, relative to the * current context. All path contexts must already be * bound in the context tree. * @param obj The new value for this binding. * * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound */ public void rebind (org.omg.CosNaming.NameComponent[] n, org.omg.CORBA.Object obj) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { // perform various name validations validateName(n); logNameComponent("rebind() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.rebind(subName, obj); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); // for a rebind, we must have an object, and it must be a real object if (resolveObject(name, type) != null) { // it has to resolve to a real object. If it is a naming context, // then this is the wrong binding operation. if (type.value.value() == BindingType._ncontext) { throw new NotFound(NotFoundReason.not_object, n); } // safe to unbind unbindObject(name); } type.value = BindingType.nobject; // now bind this object bindObject(name, obj, type); } } } /** * Bind a new context to a given name. * * @param n An array of NameComponents that are the target name. * The last element in the array is binding name for the * object. The remainder of the array is the path * for resolving the naming context, relative to the * current context. All path contexts must already be * bound in the context tree. * @param nc The new naming context added to the tree. * * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound */ public void bind_context(org.omg.CosNaming.NameComponent[] n, org.omg.CosNaming.NamingContext nc) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.AlreadyBound { // perform various name validations validateName(n); logNameComponent("bind_context() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.bind_context(subName, nc); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); if (resolveObject(name, type) != null) { throw new AlreadyBound(); } type.value = BindingType.ncontext; // ok, this is a new binding, go do it. bindObject(name, nc, type); } } } /** * Rebind a context to a given name. If a context is * already bound with this name, the new context replaces * the existing context. If no context has been * bound already, this is the same as a bind operation. * * @param n An array of NameComponents that are the target name. * The last element in the array is binding name for the * object. The remainder of the array is the path * for resolving the naming context, relative to the * current context. All path contexts must already be * bound in the context tree. * @param nc The new context to be bound with the name. * * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound */ public void rebind_context (org.omg.CosNaming.NameComponent[] n, org.omg.CosNaming.NamingContext nc) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { // perform various name validations validateName(n); logNameComponent("rebind_context() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.rebind_context(subName, nc); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); // for a rebind, we must have an object, and it must be a real object if (resolveObject(name, type) != null) { // it has to resolve to a real object. If it is a naming context, // then this is the wrong binding operation. if (type.value.value() != BindingType._ncontext) { throw new NotFound(NotFoundReason.not_context, n); } // safe to unbind unbindObject(name); } type.value = BindingType.ncontext; // now bind this object bindObject(name, nc, type); } } } /** * Resolve an an entry in the context tree. The * resolved object may be a bound object or another * NamingContext. If the named entry is not found, * a NotFound exception is thrown. * * @param n An array of NameComponents that are the target name. * The last element in the array is binding name for the * object. The remainder of the array is the path * for resolving the naming context, relative to the * current context. All path contexts must already be * bound in the context tree. * * @return The object bound at the indicated location. * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound */ public org.omg.CORBA.Object resolve (org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { // perform various name validations validateName(n); logNameComponent("resolve() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. return context.resolve(subName); } else { NameComponent name = n[0]; // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); org.omg.CORBA.Object obj = resolveObject(name, type); if (obj == null) { // Object was not found throw new NotFound(NotFoundReason.missing_node, n); } return obj; } } /** * Remove an entry from the context tree. The * target object may be a bound object or another * NamingContext. If the named entry is not found, * a NotFound exception is thrown. * * @param n An array of NameComponents that are the target name. * The last element in the array is binding name for the * object. The remainder of the array is the path * for resolving the naming context, relative to the * current context. All path contexts must already be * bound in the context tree. * * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound */ public void unbind (org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { // perform various name validations validateName(n); logNameComponent("unbind() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.unbind(subName); } else { NameComponent name = n[0]; synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); org.omg.CORBA.Object obj = unbindObject(name); if (obj == null) { // Object was not found throw new NotFound(NotFoundReason.missing_node, n); } } } } /** * Create a new context and bind it in at the target * location. * * @param n An array of NameComponents that are the target name. * The last element in the array is binding name for the * object. The remainder of the array is the path * for resolving the naming context, relative to the * current context. All path contexts must already be * bound in the context tree. * * @return The newly created context. * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound */ public synchronized org.omg.CosNaming.NamingContext bind_new_context(org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.AlreadyBound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { logNameComponent("bind_new_context() name", n); NamingContext context = new_context(); try { bind_context(n, context); NamingContext returnContext = context; // transfer this to another variable so the finally block doesn't try to destroy this. context = null; return returnContext; } finally { // if there is a bind failure on this, we need to ensure the context has // an opportunity to clean up any of its resources. if (context != null) { try { context.destroy(); } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) { // new contexts should be empty. } } } } /** * Convert an array of NameComponents into the string * form of a context name. * * @param n The array of NameComponents to convert. * * @return The context name, in string form. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName */ public String to_string(org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.InvalidName { validateName(n); logNameComponent("to_string() name", n); // convert the first part of the name StringBuffer value = new StringBuffer();; // convert the first component, then build up from there. nameToString(n[0], value); // the remainder need to get a separator for (int i = 1; i < n.length; i++) { value.append('/'); nameToString(n[i], value); } return value.toString(); } /** * Perform the reverse operation of the to_string() method, * parsing a String context name into an array of * NameComponents. * * @param sn The string form of the name. * * @return An array of NameComponents parsed from the String name. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName */ public org.omg.CosNaming.NameComponent[] to_name(String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName { // must have a argument to parse if (sn == null || sn.length() == 0) { throw new InvalidName(); } List components = new ArrayList(); StringBuffer component = new StringBuffer(); int index = 0; String id = null; String kind = null; while (index < sn.length()) { char ch = sn.charAt(index++); // found an escape character or a delimiter? if (ch == '\\') { // nothing after the escape? Trouble if (index >= sn.length()) { throw new InvalidName(); } // get the next character ch = sn.charAt(index++); component.append(ch); } // we need to process the periods here, to avoid getting // mixed up with unescaped periods. else if (ch == '.') { // already seen a period while scanning? That's not allowed if (id != null) { throw new InvalidName(); } // pull off the id piece and reset the buffer id = component.toString(); component.setLength(0); } // found a component delimiter? else if (ch == '/') { // not seen a id/kind separator yet? This is an id with no kind if (id == null) { id = component.toString(); kind = ""; } else { // we have an id already, pull off the kind kind = component.toString(); } // add the parsed name component components.add(new NameComponent(id, kind)); // make sure these are all reset after pulling off a component component.setLength(0); id = null; kind = null; } else { component.append(ch); } } // parse the last section // not seen a id/kind separator yet? This is an id with no kind if (id == null) { id = component.toString(); kind = ""; } else { // we have an id already, pull off the kind kind = component.toString(); } // add the parsed name component components.add(new NameComponent(id, kind)); // and turn this into a component array return (NameComponent[])components.toArray(new NameComponent[components.size()]); } /** * Create a URL name for accessing a component by name. The * URL will have a corbaname: protocol. * * @param addr The address location for the naming service used * to resolve the object. This is in "host:port" form, * just line a corbaloc: URL. * @param sn The string mae of the target object. * * @return A URL for accessing this object, in String form. * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidAddress * @exception org.omg.CosNaming.NamingContextPackage.InvalidName */ public String to_url (String addr, String sn) throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress, org.omg.CosNaming.NamingContextPackage.InvalidName { // basic validation if (addr == null || addr.length() == 0) { throw new InvalidAddress(); } if (sn == null || sn.length() == 0) { throw new InvalidName(); } // TODO: What validation, if any, needs to be done here? return "corbaname:" + addr + "#" + encodeRFC2396Name(sn); } /** * Resolve a bound object or context using a name * in String form. * * @param n The string name of the object context. This must * be a form parseable by to_name(). * * @return The bound object or context. * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed * @exception org.omg.CosNaming.NamingContextPackage.InvalidName */ public org.omg.CORBA.Object resolve_str(String n) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { // this is just a simple convenience method return resolve(to_name(n)); } // abstract methods that are part of the NamingContext interface that need to be // implemented by the subclasses. /** * Create a new context of the same type as the * calling context. * * @return A new NamingContext item. * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception SystemException */ public abstract org.omg.CosNaming.NamingContext new_context() throws SystemException; /** * Destroy a context. This method should clean up * any backing resources associated with the context. * * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty */ public abstract void destroy() throws org.omg.CosNaming.NamingContextPackage.NotEmpty; /** * Create a list of bound objects an contexts contained * within this context. * * @param how_many The count of elements to return as a BindingList. * @param bl A holder element for returning the source binding list. * @param bi A holder for returning a BindingIterator. Any extra * elements not returned in the BindingList are returned * in the BindingIterator. * * @exception SystemException */ public abstract void list(int how_many, org.omg.CosNaming.BindingListHolder bl, org.omg.CosNaming.BindingIteratorHolder bi) throws SystemException ; // abstract methods for the sub class to implement /** * Resolve an object in this context (single level * resolution). * * @param n The name of the target object. * @param type A type holder for returning the bound object type * information. * * @return The bound object. Returns null if the object does not * exist in the context. * @exception SystemException */ protected abstract org.omg.CORBA.Object resolveObject(NameComponent n, BindingTypeHolder type) throws SystemException; /** * Bind an object into the current context. This can * be either an object or a naming context. * * @param n The single-level name of the target object. * @param obj The object or context to be bound. * @param type * * @exception SystemException */ protected abstract void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type) throws SystemException; /** * Unbind an object from the current context. * * @param n The name of the target object (single level). * * @return The object associated with the binding. Returns null * if there was no binding currently associated with this * name. * @exception SystemException */ protected abstract org.omg.CORBA.Object unbindObject(NameComponent n) throws SystemException; // implementation specific routines /** * Resolve a name to a context object stored that has * already been stored in this context. Throws an exception * if the name cannot be resolved or if the resolved * object is not a naming context. * * @param name The target name. * * @return The resolved NamingContext object. * @exception org.omg.CosNaming.NamingContextPackage.NotFound */ protected synchronized NamingContext resolveContext(NameComponent name) throws org.omg.CosNaming.NamingContextPackage.NotFound { BindingTypeHolder type = new BindingTypeHolder(); // Resolve this to an object. We must be able to resolve this. org.omg.CORBA.Object resolvedReference = resolveObject(name, type); if (resolvedReference == null) { throw new NotFound(NotFoundReason.missing_node, new NameComponent[] { name }); } // it has to resolve to a naming context if (type.value.value() != BindingType._ncontext) { throw new NotFound(NotFoundReason.not_context, new NameComponent[] { name }); } // in theory, this is a naming context. Narrow it an return. Any // errors just become a NotFound exception try { return NamingContextHelper.narrow(resolvedReference); } catch (org.omg.CORBA.BAD_PARAM ex) { throw new NotFound(NotFoundReason.not_context, new NameComponent[] { name }); } } /** * Extract the tail portion of a name. This is used * to strip off the first name element so we can recurse * on the name resolutions with a resolved context. * * @param name The current name array (this MUST have 2 or more * elements). * * @return An array of NameComponent items that is one element * smaller than the argument array, with the elements * shifted over. */ protected NameComponent[] extractSubName(NameComponent[] name) { NameComponent[] subName = new NameComponent[name.length - 1]; System.arraycopy(name, 1, subName, 0, name.length - 1); return subName; } /** * Perform common name validity checking. * * @param n The NameComponent array to check. * * @exception InvalidName */ protected void validateName(NameComponent[] n) throws InvalidName { // perform various name validations if (n == null) { throw new BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes.MinorObjectIsNull, CompletionStatus.COMPLETED_NO); } // Valid name? if (n.length < 1) { throw new InvalidName(); } // we have at least one name, so validate the toplevel item NameComponent name = n[0]; // more name validation if (name.id.length() == 0 && name.kind.length() == 0) { throw new InvalidName(); } } /** * Convert a NameComponent item into a string form, * appending it to a StringBuffer. * * @param name The source NameComponent. * @param out The StringBuffer location used to store the name * value (appended to the end). */ protected void nameToString(NameComponent name, StringBuffer out) { // if the id is null, then we base off of the kind. if (name.id == null || name.id.length() == 0) { out.append("."); // true null name element? That displays as a "." if (name.kind != null && name.kind.length() != 0) { escapeName(name.kind, out); } } else { // escape the name escapeName(name.id, out); // have a kind qualifier to add on? if (name.kind != null && name.kind.length() != 0) { out.append("."); escapeName(name.kind, out); } } } /** * Process a name or kind element of a NameComponent, * adding escape characters for '.' or '/' characters * that might appear in the name. * * @param name The name element to process. * @param out The StringBuffer to copy the escaped name into. */ protected void escapeName(String name, StringBuffer out) { // no characters requiring escapes (common)? // use this directly if (name.indexOf('.') == -1 && name.indexOf('/') == -1) { out.append(name); } else { // scan the string adding the escapes for (int i = 0; i < name.length(); i++) { char ch = name.charAt(i); if (ch == '.' || ch == '/') { out.append('/'); } out.append(ch); } } } /** * Perform RFC 2396 escape encoding of a name value. * * @param name The input name value. * * @return An encoded name, with special characters converted * into a hex encoded value. */ protected String encodeRFC2396Name(String name) { StringBuffer value = new StringBuffer(); for (int i = 0; i < name.length(); i++) { char ch = name.charAt(i); // Alphanumerics and the "acceptable" set of special characters just get copied // without encoding. if (Character.isLetterOrDigit(ch) || nonEscaped.indexOf(ch) != -1) { value.append(ch); } else { // this gets converted into a hex value, marked by "%". value.append('%'); value.append(Integer.toHexString((int)ch)); } } return value.toString(); } /** * Test if debug logging is currently available. * * @return True if debug level (FINE) logging is currently turned on. */ protected boolean isDebugEnabled() { return logger.isLoggable(Level.FINE); } /** * Log a line of debug output * * @param message The message to log */ protected void debug(String message) { logger.fine(message); } /** * Log the name components passed in for a request. * * @param message A message describing the request context. * @param n The array of name components. */ protected void logNameComponent(String message, NameComponent[] n) { if (isDebugEnabled()) { debug(message); for (int i = 0; i < n.length; i++) { debug(" NameComponent " + i + " id=" + n[i].id + " kind=" + n[i].kind); } } } }
6,884
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming2/TransientNameServer.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. */ /** * @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $ */ package org.apache.yoko.orb.CosNaming.tnaming2; /** * A stand-alone naming service launchable from a command line. */ public class TransientNameServer { /** * Launch a name service as a stand alone process. The Host, port, and * service name are controlled using program arguments. * * @param args * The array of arguments for tailoring the service. * * @exception Exception */ public static void main(String args[]) throws Exception { int port = TransientNameService.DEFAULT_SERVICE_PORT; String host = TransientNameService.DEFAULT_SERVICE_HOST; String serviceName = TransientNameService.DEFAULT_SERVICE_NAME; // see if we have for (int i = 0; i < args.length; i++) { if (args[i].equals("-ORBInitialPort")) { i++; if (i < args.length) { port = java.lang.Integer.parseInt(args[i]); } else { throw new IllegalArgumentException("Invalid -ORBInitialPort option"); } } else if (args[i].equals("-ORBInitialHost")) { i++; if (i < args.length) { host = args[i]; } else { throw new IllegalArgumentException("Invalid -ORBInitialHost option"); } } else if (args[i].equals("-ORBServiceName")) { i++; if (i < args.length) { serviceName = args[i]; } else { throw new IllegalArgumentException("Invalid -ORBServiceName option"); } } } // create a services, and just spin it off. We wait forever after that. try (TransientNameService service = new TransientNameService(host, port, serviceName)) { service.run(); synchronized (service) { service.wait(); } } } }
6,885
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming2/NamingContextBase.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. */ /** * @version $Rev: 553831 $ $Date: 2007-07-06 03:52:10 -0700 (Fri, 06 Jul 2007) $ */ package org.apache.yoko.orb.CosNaming.tnaming2; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.yoko.orb.spi.naming.Resolvable; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.SystemException; import org.omg.CosNaming.BindingIteratorHolder; import org.omg.CosNaming.BindingListHolder; import org.omg.CosNaming.BindingType; import org.omg.CosNaming.BindingTypeHolder; import org.omg.CosNaming.NameComponent; import org.omg.CosNaming.NamingContext; import org.omg.CosNaming.NamingContextExtPOA; import org.omg.CosNaming.NamingContextHelper; import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; import org.omg.CosNaming.NamingContextPackage.AlreadyBound; import org.omg.CosNaming.NamingContextPackage.CannotProceed; import org.omg.CosNaming.NamingContextPackage.InvalidName; import org.omg.CosNaming.NamingContextPackage.NotEmpty; import org.omg.CosNaming.NamingContextPackage.NotFound; import org.omg.CosNaming.NamingContextPackage.NotFoundReason; public abstract class NamingContextBase extends NamingContextExtPOA { // the real logger backing instance. We use the interface class as the locator protected static final Logger logger = Logger.getLogger(NamingContext.class.getName()); // set of URL characters that don't require escaping when encoded. protected final String nonEscaped = ";/?:@&=+$;-_.!~* ()"; /** * Create a new base NamingContext (super class constructor for the derived * classes). */ public NamingContextBase() throws Exception { super(); } /** * Bind an object to a given name. * @param n An array of NameComponents that are the target name. The last * element in the array is binding name for the object. The * remainder of the array is the path for resolving the naming * context, relative to the current context. All path contexts * must already be bound in the context tree. * @param obj The object to be bound. */ public void bind(NameComponent[] n, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName, AlreadyBound { // perform various name validations validateName(n); logNameComponent("bind() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.bind(subName, obj); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); if (resolveObject(name, type) != null) { throw new AlreadyBound(); } type.value = BindingType.nobject; // ok, this is a new binding, go do it. bindObject(name, obj, type); } } } /** * Rebind an object to a given name. If an object is already bound with this * name, the new object replaces the bound object's value. If no object has * been bound already, this is the same as a bind operation. * @param n An array of NameComponents that are the target name. The last * element in the array is binding name for the object. The * remainder of the array is the path for resolving the naming * context, relative to the current context. All path contexts * must already be bound in the context tree. * @param obj The new value for this binding. */ public void rebind(NameComponent[] n, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName { // perform various name validations validateName(n); logNameComponent("rebind() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.rebind(subName, obj); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); // for a rebind, we must have an object, and it must be a real object if (resolveObject(name, type) != null) { // it has to resolve to a real object. If it is a naming context, // then this is the wrong binding operation. if (type.value.value() == BindingType._ncontext) { throw new NotFound(NotFoundReason.not_object, n); } // safe to unbind unbindObject(name); } type.value = BindingType.nobject; // now bind this object bindObject(name, obj, type); } } } /** * Bind a new context to a given name. * @param n An array of NameComponents that are the target name. The last * element in the array is binding name for the object. The * remainder of the array is the path for resolving the naming * context, relative to the current context. All path contexts * must already be bound in the context tree. * @param nc The new naming context added to the tree. */ public void bind_context(NameComponent[] n, NamingContext nc) throws NotFound, CannotProceed, InvalidName, AlreadyBound { // perform various name validations validateName(n); logNameComponent("bind_context() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.bind_context(subName, nc); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); if (resolveObject(name, type) != null) { throw new AlreadyBound(); } type.value = BindingType.ncontext; // ok, this is a new binding, go do it. bindObject(name, nc, type); } } } /** * Rebind a context to a given name. If a context is already bound with this * name, the new context replaces the existing context. If no context has * been bound already, this is the same as a bind operation. * @param n An array of NameComponents that are the target name. The last * element in the array is binding name for the object. The * remainder of the array is the path for resolving the naming * context, relative to the current context. All path contexts * must already be bound in the context tree. * @param nc The new context to be bound with the name. */ public void rebind_context(NameComponent[] n, NamingContext nc) throws NotFound, CannotProceed, InvalidName { // perform various name validations validateName(n); logNameComponent("rebind_context() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.rebind_context(subName, nc); } else { NameComponent name = n[0]; // we need the resolveObject() and bindObject() calls to be consistent, so // synchronize on this synchronized (this) { // see if we have this bound already...can't replace these. BindingTypeHolder type = new BindingTypeHolder(); // for a rebind, we must have an object, and it must be a real object if (resolveObject(name, type) != null) { // it has to resolve to a real object. If it is a naming context, // then this is the wrong binding operation. if (type.value.value() != BindingType._ncontext) { throw new NotFound(NotFoundReason.not_context, n); } // safe to unbind unbindObject(name); } type.value = BindingType.ncontext; // now bind this object bindObject(name, nc, type); } } } /** * Resolve an an entry in the context tree. The resolved object may be a * bound object or another NamingContext. If the named entry is not found, a * NotFound exception is thrown. * @param n An array of NameComponents that are the target name. The last * element in the array is binding name for the object. The * remainder of the array is the path for resolving the naming * context, relative to the current context. All path contexts * must already be bound in the context tree. * @return The object bound at the indicated location. */ public org.omg.CORBA.Object resolve(NameComponent[] n) throws NotFound, CannotProceed, InvalidName { // perform various name validations validateName(n); logNameComponent("resolve() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real resolve operation. return context.resolve(subName); } else { NameComponent name = n[0]; BindingTypeHolder type = new BindingTypeHolder(); org.omg.CORBA.Object obj = resolveObject(name, type); if (obj == null) { // Object was not found throw new NotFound(NotFoundReason.missing_node, n); } if (obj instanceof Resolvable) { return ((Resolvable)obj).resolve(); } else { return obj; } } } /** * Remove an entry from the context tree. The target object may be a bound * object or another NamingContext. If the named entry is not found, a * NotFound exception is thrown. * @param n An array of NameComponents that are the target name. The last * element in the array is binding name for the object. The * remainder of the array is the path for resolving the naming * context, relative to the current context. All path contexts * must already be bound in the context tree. * @exception NotFound * @exception CannotProceed * @exception InvalidName * @exception AlreadyBound */ public void unbind(NameComponent[] n) throws NotFound, CannotProceed, InvalidName { // perform various name validations validateName(n); logNameComponent("unbind() name", n); // do we need to push through to a deeper naming context first? if (n.length > 1) { // resolve the top level name to a context, and have that context // resolve the rest. NamingContext context = resolveContext(n[0]); NameComponent[] subName = extractSubName(n); // now pass this along to the next context for the real bind operation. context.unbind(subName); } else { NameComponent name = n[0]; synchronized (this) { // see if we have this bound already...can't replace these. org.omg.CORBA.Object obj = unbindObject(name); if (obj == null) { // Object was not found throw new NotFound(NotFoundReason.missing_node, n); } } } } /** * Create a new context and bind it in at the target location. * @param n An array of NameComponents that are the target name. The last * element in the array is binding name for the object. The * remainder of the array is the path for resolving the naming * context, relative to the current context. All path contexts * must already be bound in the context tree. * @return The newly created context. */ public synchronized NamingContext bind_new_context(NameComponent[] n) throws NotFound, AlreadyBound, CannotProceed, InvalidName { logNameComponent("bind_new_context() name", n); NamingContext context = new_context(); try { bind_context(n, context); NamingContext returnContext = context; // transfer this to another variable so the finally block doesn't try to destroy this. context = null; return returnContext; } finally { // if there is a bind failure on this, we need to ensure the context has // an opportunity to clean up any of its resources. if (context != null) { try { context.destroy(); } catch (NotEmpty e) { // new contexts should be empty. } } } } /** * Convert an array of NameComponents into the string form of a context * name. * @param n The array of NameComponents to convert. * @return The context name, in string form. */ public String to_string(NameComponent[] n) throws InvalidName { validateName(n); logNameComponent("to_string() name", n); // convert the first part of the name StringBuffer value = new StringBuffer();; // convert the first component, then build up from there. nameToString(n[0], value); // the remainder need to get a separator for (int i = 1; i < n.length; i++) { value.append('/'); nameToString(n[i], value); } return value.toString(); } /** * Perform the reverse operation of the to_string() method, parsing a String * context name into an array of NameComponents. * @param sn The string form of the name. * @return An array of NameComponents parsed from the String name. */ public NameComponent[] to_name(String sn) throws InvalidName { // must have a argument to parse if (sn == null || sn.length() == 0) { throw new InvalidName(); } List<NameComponent> components = new ArrayList<NameComponent>(); StringBuffer component = new StringBuffer(); int index = 0; String id = null; String kind = null; while (index < sn.length()) { char ch = sn.charAt(index++); // found an escape character or a delimiter? if (ch == '\\') { // nothing after the escape? Trouble if (index >= sn.length()) { throw new InvalidName(); } // get the next character ch = sn.charAt(index++); component.append(ch); } // we need to process the periods here, to avoid getting // mixed up with unescaped periods. else if (ch == '.') { // already seen a period while scanning? That's not allowed if (id != null) { throw new InvalidName(); } // pull off the id piece and reset the buffer id = component.toString(); component.setLength(0); } // found a component delimiter? else if (ch == '/') { // not seen a id/kind separator yet? This is an id with no kind if (id == null) { id = component.toString(); kind = ""; } else { // we have an id already, pull off the kind kind = component.toString(); } // add the parsed name component components.add(new NameComponent(id, kind)); // make sure these are all reset after pulling off a component component.setLength(0); id = null; kind = null; } else { component.append(ch); } } // parse the last section // not seen a id/kind separator yet? This is an id with no kind if (id == null) { id = component.toString(); kind = ""; } else { // we have an id already, pull off the kind kind = component.toString(); } // add the parsed name component components.add(new NameComponent(id, kind)); // and turn this into a component array return (NameComponent[]) components.toArray(new NameComponent[components.size()]); } /** * Create a URL name for accessing a component by name. The URL will have a * corbaname: protocol. * @param addr The address location for the naming service used to resolve * the object. This is in "host:port" form, just line a corbaloc: * URL. * @param sn The string mae of the target object. * @return A URL for accessing this object, in String form. */ public String to_url(String addr, String sn) throws InvalidAddress, InvalidName { // basic validation if (addr == null || addr.length() == 0) { throw new InvalidAddress(); } if (sn == null || sn.length() == 0) { throw new InvalidName(); } // TODO: What validation, if any, needs to be done here? return "corbaname:" + addr + "#" + encodeRFC2396Name(sn); } /** * Resolve a bound object or context using a name in String form. * @param n The string name of the object context. This must be a form * parseable by to_name(). * @return The bound object or context. */ public org.omg.CORBA.Object resolve_str(String n) throws NotFound, CannotProceed, InvalidName { // this is just a simple convenience method return resolve(to_name(n)); } // abstract methods that are part of the NamingContext interface that need // to be implemented by the subclasses. /** * Create a new context of the same type as the calling context. * @return A new NamingContext item. */ public abstract NamingContext new_context() throws SystemException; /** * Destroy a context. This method should clean up any backing resources * associated with the context. */ public abstract void destroy() throws NotEmpty; /** * Create a list of bound objects and contexts contained within this context. * @param how_many The count of elements to return as a BindingList. * @param bl A holder element for returning the source binding list. * @param bi A holder for returning a BindingIterator. Any extra elements * not returned in the BindingList are returned in the * BindingIterator. */ public abstract void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi) throws SystemException; // abstract methods for the sub class to implement /** * Resolve an object in this context (single level resolution). * @param n The name of the target object. * @param type A type holder for returning the bound object type * information. * @return The bound object. Returns null if the object does not exist in * the context. */ protected abstract org.omg.CORBA.Object resolveObject(NameComponent n, BindingTypeHolder type) throws SystemException; /** * Bind an object into the current context. This can be either an object or * a naming context. * @param n The single-level name of the target object. * @param obj The object or context to be bound. * @param type */ protected abstract void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type) throws SystemException, CannotProceed; /** * Unbind an object from the current context. * @param n The name of the target object (single level). * @return The object associated with the binding. Returns null if there was * no binding currently associated with this name. */ protected abstract org.omg.CORBA.Object unbindObject(NameComponent n) throws SystemException, CannotProceed; // implementation specific routines /** * Resolve a name to a context object stored that has already been stored in * this context. Throws an exception if the name cannot be resolved or if * the resolved object is not a naming context. * @param name The target name. * @return The resolved NamingContext object. */ protected synchronized NamingContext resolveContext(NameComponent name) throws NotFound { BindingTypeHolder type = new BindingTypeHolder(); // Resolve this to an object. We must be able to resolve this. org.omg.CORBA.Object resolvedReference = resolveObject(name, type); if (resolvedReference == null) { throw new NotFound(NotFoundReason.missing_node, new NameComponent[]{name}); } // it has to resolve to a naming context if (type.value.value() != BindingType._ncontext) { throw new NotFound(NotFoundReason.not_context, new NameComponent[]{name}); } // in theory, this is a naming context. Narrow it and return. Any // errors just become a NotFound exception try { return NamingContextHelper.narrow(resolvedReference); } catch (org.omg.CORBA.BAD_PARAM ex) { throw new NotFound(NotFoundReason.not_context, new NameComponent[]{name}); } } /** * Extract the tail portion of a name. This is used to strip off the first * name element so we can recurse on the name resolutions with a resolved * context. * @param name The current name array (this MUST have 2 or more elements). * @return An array of NameComponent items that is one element smaller than * the argument array, with the elements shifted over. */ protected NameComponent[] extractSubName(NameComponent[] name) { NameComponent[] subName = new NameComponent[name.length - 1]; System.arraycopy(name, 1, subName, 0, name.length - 1); return subName; } /** * Perform common name validity checking. * @param n The NameComponent array to check. */ protected void validateName(NameComponent[] n) throws InvalidName { // perform various name validations if (n == null) { throw new BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes.MinorObjectIsNull, CompletionStatus.COMPLETED_NO); } // Valid name? if (n.length < 1) { throw new InvalidName(); } // we have at least one name, so validate the toplevel item NameComponent name = n[0]; // for remote invocation, client would have received an NPE on marshalling a NameComponent with a null field // for local invocation, ok to propagate the NPE and not a CORBA BAD_PARAM Objects.requireNonNull(name.id, "A NameComponent must not have a null id field"); Objects.requireNonNull(name.kind, "A NameComponent must not have a null kind field"); // This ensures the name is not completely empty, but is this correct? CosNaming1.4 2.4.1 says: // > The single '.' character is the only representation of a name with empty id and kind fields. if (name.id.isEmpty() && name.kind.isEmpty()) { throw new InvalidName(); } } /** * Convert a NameComponent item into a string form, appending it to a * StringBuffer. * @param name The source NameComponent. * @param out The StringBuffer location used to store the name value * (appended to the end). */ protected void nameToString(NameComponent name, StringBuffer out) { // if the id is null, then we base off of the kind. if (name.id == null || name.id.length() == 0) { out.append("."); // true null name element? That displays as a "." if (name.kind != null && name.kind.length() != 0) { escapeName(name.kind, out); } } else { // escape the name escapeName(name.id, out); // have a kind qualifier to add on? if (name.kind != null && name.kind.length() != 0) { out.append("."); escapeName(name.kind, out); } } } /** * Process a name or kind element of a NameComponent, adding escape * characters for '.' or '/' characters that might appear in the name. * @param name The name element to process. * @param out The StringBuffer to copy the escaped name into. */ protected void escapeName(String name, StringBuffer out) { // no characters requiring escapes (common)? // use this directly if (name.indexOf('.') == -1 && name.indexOf('/') == -1) { out.append(name); } else { // scan the string adding the escapes for (int i = 0; i < name.length(); i++) { char ch = name.charAt(i); if (ch == '.' || ch == '/' || ch == '\\') { out.append('\\'); } out.append(ch); } } } /** * Perform RFC 2396 escape encoding of a name value. * @param name The input name value. * @return An encoded name, with special characters converted into a hex * encoded value. */ protected String encodeRFC2396Name(String name) { StringBuffer value = new StringBuffer(); for (int i = 0; i < name.length(); i++) { char ch = name.charAt(i); // Alphanumerics and the "acceptable" set of special characters just // get copied without encoding. if (Character.isLetterOrDigit(ch) || nonEscaped.indexOf(ch) != -1) { value.append(ch); } else { // this gets converted into a hex value, marked by "%". value.append('%'); value.append(Integer.toHexString((int) ch)); } } return value.toString(); } /** * Test if debug logging is currently available. * @return True if debug level (FINE) logging is currently turned on. */ protected boolean isDebugEnabled() { return logger.isLoggable(Level.FINE); } /** * Log a line of debug output * @param message The message to log */ protected void debug(String message) { logger.fine(message); } /** * Log the name components passed in for a request. * @param message A message describing the request context. * @param n The array of name components. */ protected void logNameComponent(String message, NameComponent[] n) { if (isDebugEnabled()) { debug(message); for (int i = 0; i < n.length; i++) { debug(" NameComponent " + i + " id=" + n[i].id + " kind=" + n[i].kind); } } } }
6,886
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming2/BindingIteratorImpl.java
package org.apache.yoko.orb.CosNaming.tnaming2; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicLong; import org.apache.yoko.orb.CosNaming.tnaming2.NamingContextImpl.BoundObject; import org.apache.yoko.orb.spi.naming.RemoteAccess; import org.omg.CORBA.LocalObject; import org.omg.CosNaming.Binding; import org.omg.CosNaming.BindingHolder; import org.omg.CosNaming.BindingIterator; import org.omg.CosNaming.BindingIteratorPOA; import org.omg.CosNaming.BindingListHolder; import org.omg.CosNaming.BindingType; import org.omg.CosNaming.NameComponent; import org.omg.PortableServer.POA; import org.omg.PortableServer.Servant; public final class BindingIteratorImpl extends LocalObject implements BindingIterator, RemotableObject { private static final long serialVersionUID = 1L; private static final class Core extends BindingIteratorPOA { private static final AtomicLong NEXT_ID = new AtomicLong(); private final long instanceId = NEXT_ID.getAndIncrement(); // the iterator use to access the bindings private final Iterator<BoundObject> iterator; private static final NameComponent[] ZERO_NC_ARRAY = new NameComponent[0]; /** * Create a new BindingIterator to iterate over the given boundObjects. * @param boundObjects The bound objects over which to iterate. */ public Core(Collection<BoundObject> boundObjects) { this.iterator = (new ArrayList<BoundObject>(boundObjects)).iterator(); } private byte[] getServantId() { return ("BindingIterator#" + instanceId).getBytes(); } /** * Return the next object in the iteration sequence. * @param b The BindingHolder used to return the next item. If we've * reached the end of the sequence, an item with an empty * name is returned. * @return true if there is another item, false otherwise. */ public boolean next_one(org.omg.CosNaming.BindingHolder b) { if (iterator.hasNext()) { // return this as a Binding value. BoundObject obj = iterator.next(); b.value = new Binding(new NameComponent[]{obj.name}, obj.type); return true; } else { // return an empty element b.value = new Binding(ZERO_NC_ARRAY, BindingType.nobject); return false; } } /** * Retrieve the next "n" items from the list, returned as a BindingList. * @param how_many The count of items to retrieve. * @param bl A holder for returning an array of Bindings for the * returned items. * @return true if any items were returned, false if there's nothing left * to return. */ public boolean next_n(int how_many, org.omg.CosNaming.BindingListHolder bl) { List<Binding> accum = new ArrayList<Binding>(); BindingHolder holder = new BindingHolder(); int i = 0; // Keep iterating as long as there are entries while (i < how_many && next_one(holder)) { accum.add(holder.value); i++; } // convert to an array and return whether we found anything. bl.value = accum.toArray(new Binding[accum.size()]); return accum.isEmpty(); } /** * Destroy this BindingIterator instance */ public void destroy() { } } private static final class POAServant extends BindingIteratorPOA { // the POA used to activate this object (required for destroy(); private final POA poa; private final Core core; public POAServant(POA poa, Core core) throws Exception { this.poa = poa; this.core = core; poa.activate_object_with_id(core.getServantId(), this); } /** * Return the next object in the iteration sequence. * @param b The BindingHolder used to return the next item. If we've * reached the end of the sequence, an item with an empty * name is returned. * @return true if there is another item, false otherwise. */ @Override public boolean next_one(org.omg.CosNaming.BindingHolder b) { return core.next_one(b); } /** * Retrieve the next "n" items from the list, returned as a BindingList. * @param how_many The count of items to retrieve. * @param bl A holder for returning an array of Bindings for the * returned items. * @return true if any items were returned, false if there's nothing left * to return. */ @Override public boolean next_n(int how_many, org.omg.CosNaming.BindingListHolder bl) { return core.next_n(how_many, bl); } /** * Destroy this BindingIterator instance, which deactivates it from the * hosting POA. */ @Override public void destroy() { try { // we need to deactivate this from the POA. byte[] objectId = poa.servant_to_id(this); if (objectId != null) { poa.deactivate_object(objectId); } } catch (Exception e) { } } } private final Core core; public BindingIteratorImpl(final Collection<BoundObject> boundObjects) { assert boundObjects != null; core = new Core(boundObjects); } @Override public boolean next_one(BindingHolder b) { assert b != null; return core.next_one(b); } @Override public boolean next_n(int how_many, BindingListHolder bl) { assert bl != null; return core.next_n(how_many, bl); } @Override public void destroy() { core.destroy(); } @Override public Servant getServant(POA poa, RemoteAccess ignored) throws Exception { return new POAServant(poa, core); } }
6,887
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming2/TransientServiceException.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. */ /** * @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $ */ package org.apache.yoko.orb.CosNaming.tnaming2; public class TransientServiceException extends Exception { private static final long serialVersionUID = 1L; public TransientServiceException() { super(); } public TransientServiceException(String reason) { super(reason); } public TransientServiceException(String reason, Exception cause) { super(reason, cause); } }
6,888
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming2/RemotableObject.java
package org.apache.yoko.orb.CosNaming.tnaming2; import org.apache.yoko.orb.spi.naming.RemoteAccess; import org.omg.PortableServer.POA; import org.omg.PortableServer.Servant; public interface RemotableObject { Servant getServant(POA poa, RemoteAccess remoteAccess) throws Exception; }
6,889
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming2/TransientNameService.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. */ /** * @version $Rev: 555715 $ $Date: 2007-07-12 11:36:16 -0700 (Thu, 12 Jul 2007) $ */ package org.apache.yoko.orb.CosNaming.tnaming2; import java.util.Properties; import org.apache.yoko.orb.spi.naming.NameServiceInitializer; import org.omg.CORBA.ORB; /** * A transient name service attached to an ORB. This class manages all of the * housekeeping for creating a TransientNamingContext and a exposing it using an * ORB. */ public class TransientNameService implements AutoCloseable { // the default registered name service static public final String DEFAULT_SERVICE_NAME = "TNameService"; // the default listening port static public final int DEFAULT_SERVICE_PORT = 900; // the default host name static public final String DEFAULT_SERVICE_HOST = "localhost"; // initial listening port protected int port; // initial listening host protected String host; // the service name (used for registering for the corbaloc:: URL name protected String serviceName; // the orb instance we're running on protected ORB createdOrb; /** * Create a new TransientNameService, using all default attributes. */ public TransientNameService() { this(DEFAULT_SERVICE_HOST, DEFAULT_SERVICE_PORT, DEFAULT_SERVICE_NAME); } /** * Create a default-named name service using the specified host and port * parameters. * @param host The host to expose this under. * @param port The initial listening port. */ public TransientNameService(String host, int port) { this(host, port, DEFAULT_SERVICE_NAME); } /** * Create a specifically-named name service using the specified host and * port parameters. * @param host The host to expose this under. * @param port The initial listening port. * @param name The name to register this service under using the * BootManager. */ public TransientNameService(String host, int port, String name) { this.port = port; this.host = host; this.serviceName = name; } /** * Start up the name service, including creating an ORB instance to expose * it under. * @exception TransientServiceException */ public void run() throws TransientServiceException { // Create an ORB object java.util.Properties props = new Properties(); props.putAll(System.getProperties()); props.put("org.omg.CORBA.ORBServerId", "1000000"); props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); props.put("org.omg.PortableInterceptor.ORBInitializerClass." + NameServiceInitializer.class.getName(), ""); props.put("yoko.orb.oa.endpoint", "iiop --host " + host + " --port " + port); createdOrb = ORB.init(new String[]{"ORBNameService=" + serviceName}, props); // service initialized by orb initializer } /** * Destroy the created service. */ public void destroy() { // only destroy this if we created the orb instance. if (createdOrb != null) { createdOrb.destroy(); createdOrb = null; } } @Override public void close() throws Exception { destroy(); } }
6,890
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming2/NamingContextImpl.java
package org.apache.yoko.orb.CosNaming.tnaming2; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.concurrent.atomic.AtomicLong; import org.apache.yoko.orb.spi.naming.RemoteAccess; import org.apache.yoko.orb.util.UnmodifiableEnumMap; import org.omg.CORBA.INTERNAL; import org.omg.CORBA.LocalObject; import org.omg.CORBA.NO_PERMISSION; import org.omg.CORBA.SystemException; import org.omg.CosNaming.BindingIteratorHelper; import org.omg.CosNaming.BindingIteratorHolder; import org.omg.CosNaming.BindingListHolder; import org.omg.CosNaming.BindingType; import org.omg.CosNaming.BindingTypeHolder; import org.omg.CosNaming.NameComponent; import org.omg.CosNaming.NamingContext; import org.omg.CosNaming.NamingContextExt; import org.omg.CosNaming.NamingContextHelper; import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; import org.omg.CosNaming.NamingContextPackage.AlreadyBound; import org.omg.CosNaming.NamingContextPackage.CannotProceed; import org.omg.CosNaming.NamingContextPackage.InvalidName; import org.omg.CosNaming.NamingContextPackage.NotEmpty; import org.omg.CosNaming.NamingContextPackage.NotFound; import org.omg.PortableServer.POA; import org.omg.PortableServer.Servant; import org.omg.PortableServer.POAPackage.ObjectNotActive; public final class NamingContextImpl extends LocalObject implements NamingContextExt, RemotableObject { private static final long serialVersionUID = 1L; private static final class ServantCreationLock { } private static final class Core extends NamingContextBase { private static final AtomicLong NEXT_ID = new AtomicLong(); /** Unique number for this core */ private final long instanceId = NEXT_ID.getAndIncrement(); /** the unique ids for this context's servants (one per remote access level) */ @SuppressWarnings("serial") private final Map<RemoteAccess, String> servantIds = new UnmodifiableEnumMap<RemoteAccess, String>(RemoteAccess.class) { public String computeValueFor(RemoteAccess key) { return "NamingContext#" + instanceId + "$" + key; } }; /** the bindings maintained by this context */ private final HashMap<BindingKey, BoundObject> bindings = new HashMap<BindingKey, BoundObject>(); /** the root context object */ private final org.omg.CORBA.Object rootContext; private Core(org.omg.CORBA.Object rootContext) throws Exception { this.rootContext = rootContext; } /** * Get the servant id to use for this context with the specified remote * access level */ private byte[] getServantId(RemoteAccess access) { return servantIds.get(access).getBytes(); } // abstract methods part of the interface contract that the // implementation is required // to supply. /** * Create a new context of the same type as the calling context. * @return A new NamingContext item. */ @Override public NamingContext new_context() { try { // create a new context. NamingContextImpl newContext = new NamingContextImpl(rootContext); return newContext; } catch (SystemException e) { // just propagate system exceptions throw e; } catch (Exception e) { throw (INTERNAL) (new INTERNAL("Unable to create new naming context").initCause(e)); } } /** * Destroy a context. This method should clean up any backing resources * associated with the context. */ @Override public synchronized void destroy() throws NotEmpty { // still holding bound objects? Not allowed to destroy if (!bindings.isEmpty()) { throw new NotEmpty(); } } /** * Create a list of bound objects an contexts contained within this * context. * @param how_many The count of elements to return as a BindingList. * @param bl A holder element for returning the source binding list. * @param bi A holder for returning a BindingIterator. Any extra * elements not returned in the BindingList are returned in * the BindingIterator. */ @Override public synchronized void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi) { BindingIteratorImpl iterator = new BindingIteratorImpl(bindings.values()); // have the iterator fill in the entries here iterator.next_n(how_many, bl); bi.value = iterator; } // lower level functions that are used by the base class /** * Resolve an object in this context (single level resolution). * @param n The name of the target object. * @param type A type holder for returning the bound object type * information. * @return The bound object. Returns null if the object does not exist * in the context. */ @Override protected org.omg.CORBA.Object resolveObject(NameComponent n, BindingTypeHolder type) { // special call to resolve the root context. This is the only one // that goes backwards. if (n.id.length() == 0 && n.kind.length() == 0) { // this is a name context item, so set it properly. type.value = BindingType.ncontext; return rootContext; } BindingKey key = new BindingKey(n); BoundObject obj = (BoundObject) bindings.get(key); // if not in the table, just return null if (obj == null) { return null; } // update the type information and return the bound object // reference. type.value = obj.type; return obj.boundObject; } /** * Bind an object into the current context. This can be either an object * or a naming context. * @param n The single-level name of the target object. * @param obj The object or context to be bound. * @param type */ @Override protected void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type) { // fairly simple table put... bindings.put(new BindingKey(n), new BoundObject(n, obj, type.value)); } /** * Unbind an object from the current context. * @param n The name of the target object (single level). * @return The object associated with the binding. Returns null if there * was no binding currently associated with this name. */ @Override protected org.omg.CORBA.Object unbindObject(NameComponent n) { // remove the object from the hash table, returning the bound object // if it exists. BindingKey key = new BindingKey(n); BoundObject obj = (BoundObject) bindings.remove(key); if (obj != null) { return obj.boundObject; } return null; } /** * Internal class used for HashMap lookup keys. */ private static final class BindingKey { // the name component this is a HashMap key for. private final NameComponent name; private final int hashval; /** * Create a new BindingKey for a NameComponent. * @param n The lookup name. */ public BindingKey(NameComponent n) { name = n; hashval = Objects.hashCode(name.id) + Objects.hashCode(name.kind); } /** * Return the hashcode associated with this binding key. The * hashcode is created using the NameComponent id and kind fields. * @return The lookup hashvalue associated with this key. */ @Override public int hashCode() { return hashval; } /** * Compare two BindingKeys for equality (used for HashMap lookups). * @param other The comparison partner. * @return True if the keys are equivalent, false otherwise. */ @Override public boolean equals(Object other) { // if not given or the wrong type, this is false. if (!!!(other instanceof BindingKey)) { return false; } BindingKey otherKey = (BindingKey) other; return (Objects.equals(name.id, otherKey.name.id) && Objects.equals(name.kind, otherKey.name.kind)); } @Override public String toString() { return "" + name; } } } private static abstract class POAServant extends NamingContextBase { static POAServant create(NamingContextImpl localContext, Core core, POA poa, RemoteAccess remoteAccess) throws Exception { switch (remoteAccess) { case readOnly : return new ReadOnly(localContext, core, poa); case readWrite : return new ReadWrite(localContext, core, poa); default : throw new IllegalArgumentException("Unsupported remote access type: " + remoteAccess); } } final Object localContext; final NamingContextBase core; final POA poa; protected POAServant(NamingContextImpl localContext, Core core, POA poa, byte[] servantId) throws Exception { this.localContext = localContext; this.core = core; this.poa = poa; poa.activate_object_with_id(servantId, this); } abstract Servant convertLocalContextToRemoteContext(NamingContextImpl o) throws Exception; @Override protected final org.omg.CORBA.Object resolveObject(NameComponent n, BindingTypeHolder type) { try { org.omg.CORBA.Object o = core.resolveObject(n, type); if (o == localContext) { return _this_object(); } else if (!!!(o instanceof NamingContextImpl)) { return o; } Servant poaNamingContext = convertLocalContextToRemoteContext((NamingContextImpl) o); return NamingContextHelper.narrow(poaNamingContext._this_object()); } catch (SystemException e) { // just propagate system exceptions throw e; } catch (Exception e) { throw (INTERNAL) (new INTERNAL("Unable to create new naming context").initCause(e)); } } @Override public final void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi) { core.list(how_many, bl, bi); try { Servant iterator = ((BindingIteratorImpl) bi.value).getServant(poa, null); bi.value = BindingIteratorHelper.narrow(iterator._this_object()); } catch (SystemException e) { // just propagate system exceptions throw e; } catch (Exception e) { throw (INTERNAL) (new INTERNAL("Unable to activate BindingIterator").initCause(e)); } } private static final class ReadOnly extends POAServant { ReadOnly(NamingContextImpl localContext, Core core, POA poa) throws Exception { super(localContext, core, poa, core.getServantId(RemoteAccess.readOnly)); } private SystemException newSystemException() { return new NO_PERMISSION(); } @Override public NamingContext new_context() { throw newSystemException(); } @Override protected void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type) { throw newSystemException(); } @Override protected org.omg.CORBA.Object unbindObject(NameComponent n) { throw newSystemException(); } @Override protected Servant convertLocalContextToRemoteContext(NamingContextImpl context) throws Exception { return context.getServant(poa, RemoteAccess.readOnly); } @Override public void destroy() { throw newSystemException(); } } private static final class ReadWrite extends POAServant { ReadWrite(NamingContextImpl localContext, Core core, POA poa) throws Exception { super(localContext, core, poa, core.getServantId(RemoteAccess.readWrite)); } @Override public NamingContext new_context() { try { NamingContextImpl nci = (NamingContextImpl) core.new_context(); Servant newContext = nci.getServant(poa, RemoteAccess.readWrite); return NamingContextHelper.narrow(newContext._this_object()); } catch (SystemException e) { // just propagate system exceptions throw e; } catch (Exception e) { throw (INTERNAL) (new INTERNAL("Unable to create new naming context").initCause(e)); } } @Override protected void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type) throws SystemException, CannotProceed { core.bindObject(n, obj, type); } @Override protected org.omg.CORBA.Object unbindObject(NameComponent n) throws SystemException, CannotProceed { return core.unbindObject(n); } protected Servant convertLocalContextToRemoteContext(NamingContextImpl context) throws Exception { return context.getServant(poa, RemoteAccess.readWrite); } @Override public void destroy() throws NotEmpty { try { // we need to deactivate this from the POA. byte[] objectId = poa.servant_to_id(this); if (objectId != null) { poa.deactivate_object(objectId); } } catch (Exception e) { } } } } /** * Internal class used to store bound objects in the HashMap. */ public static final class BoundObject { // the name this object is bound under. public final NameComponent name; // the type of binding (either nobject or ncontext). public final BindingType type; // the actual bound object. public final org.omg.CORBA.Object boundObject; /** * Create a new object binding for our HashMap. * @param name The bound object's name. * @param boundObject The bound object (real object or NamingContext). * @param type The type information associated with this binding. */ private BoundObject(NameComponent name, org.omg.CORBA.Object boundObject, BindingType type) { this.name = name; this.boundObject = boundObject; this.type = type; } @Override public String toString() { return name + "->" + boundObject; } } private final Core core; /** lock for servant creation */ private final Object servantCreationLock = new ServantCreationLock(); public NamingContextImpl() throws Exception { core = new Core(this); } public NamingContextImpl(org.omg.CORBA.Object rootContext) throws Exception { core = new Core(rootContext); } @Override public void bind(NameComponent[] n, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName, AlreadyBound { core.bind(n, obj); } @Override public void bind_context(NameComponent[] n, NamingContext nc) throws NotFound, CannotProceed, InvalidName, AlreadyBound { core.bind_context(n, nc); } @Override public void rebind(NameComponent[] n, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName { core.rebind(n, obj); } @Override public void rebind_context(NameComponent[] n, NamingContext nc) throws NotFound, CannotProceed, InvalidName { core.rebind_context(n, nc); } @Override public org.omg.CORBA.Object resolve(NameComponent[] n) throws NotFound, CannotProceed, InvalidName { return core.resolve(n); } @Override public void unbind(NameComponent[] n) throws NotFound, CannotProceed, InvalidName { core.unbind(n); } @Override public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi) { core.list(how_many, bl, bi); } @Override public NamingContext new_context() { return core.new_context(); } @Override public NamingContext bind_new_context(NameComponent[] n) throws NotFound, AlreadyBound, CannotProceed, InvalidName { return core.bind_new_context(n); } @Override public void destroy() throws NotEmpty { core.destroy(); } @Override public Servant getServant(POA poa, RemoteAccess remoteAccess) throws Exception { byte[] sid = core.getServantId(remoteAccess); // synchronize around creation to avoid a race synchronized (servantCreationLock) { // check whether the servant needs to be created try { return poa.id_to_servant(sid); } catch (ObjectNotActive expected) { // guaranteed to be the unique creator-thread for this servant return POAServant.create(this, core, poa, remoteAccess); } } } @Override public String to_string(NameComponent[] n) throws InvalidName { return core.to_string(n); } @Override public NameComponent[] to_name(String sn) throws InvalidName { return core.to_name(sn); } @Override public String to_url(String addr, String sn) throws InvalidAddress, InvalidName { return core.to_url(addr, sn); } @Override public org.omg.CORBA.Object resolve_str(String n) throws NotFound, CannotProceed, InvalidName { return core.resolve_str(n); } }
6,891
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming/TransientNameServer.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. */ /** * @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $ */ package org.apache.yoko.orb.CosNaming.tnaming; /** * A stand-alone naming service launchable from a command line. */ public class TransientNameServer { /** * Launch a name service as a stand alone process. The * Host, port, and service name are controlled using * program arguments. * * @param args The array of arguments for tailoring the service. * * @exception Exception */ public static void main(String args[])throws Exception { int port = TransientNameService.DEFAULT_SERVICE_PORT; String host = TransientNameService.DEFAULT_SERVICE_HOST; String serviceName = TransientNameService.DEFAULT_SERVICE_NAME; // see if we have for (int i = 0; i < args.length; i++) { if (args[i].equals("-ORBInitialPort")) { i++; if (i < args.length) { port = java.lang.Integer.parseInt(args[i]); } else { throw new IllegalArgumentException("Invalid -ORBInitialPort option"); } } else if (args[i].equals("-ORBInitialHost")) { i++; if (i < args.length) { host = args[i]; } else { throw new IllegalArgumentException("Invalid -ORBInitialHost option"); } } else if (args[i].equals("-ORBServiceName")) { i++; if (i < args.length) { serviceName = args[i]; } else { throw new IllegalArgumentException("Invalid -ORBServiceName option"); } } } // create a services, and just spin it off. We wait forever after that. TransientNameService service = new TransientNameService(host, port, serviceName); service.run(); // now we just sit and wait here. synchronized (service) { service.wait(); } } }
6,892
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming/TransientServiceException.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. */ /** * @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $ */ package org.apache.yoko.orb.CosNaming.tnaming; public class TransientServiceException extends Exception { public TransientServiceException () { super(); } public TransientServiceException(String reason) { super(reason); } public TransientServiceException(String reason, Exception cause) { super(reason, cause); } }
6,893
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming/TransientNameService.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. */ /** * @version $Rev: 555715 $ $Date: 2007-07-12 11:36:16 -0700 (Thu, 12 Jul 2007) $ */ package org.apache.yoko.orb.CosNaming.tnaming; import java.util.Properties; import org.omg.CORBA.ORB; import org.omg.CORBA.Policy; import org.omg.PortableServer.IdAssignmentPolicyValue; import org.omg.PortableServer.LifespanPolicyValue; import org.omg.PortableServer.POA; import org.omg.PortableServer.ServantRetentionPolicyValue; /** * A transient name service attached to an ORB. This class manages all of the * housekeeping for creating a TransientNamingContext and a exposing it using an * ORB. */ public class TransientNameService implements AutoCloseable { // the default registered name service static public final String DEFAULT_SERVICE_NAME = "TNameService"; // the default listening port static public final int DEFAULT_SERVICE_PORT = 900; // the default host name static public final String DEFAULT_SERVICE_HOST = "localhost"; // the service root context protected TransientNamingContext initialContext; // initial listening port protected int port; // initial listening host protected String host; // the service name (used for registering for the corbaloc:: URL name protected String serviceName; // the orb instance we're running on protected ORB createdOrb; /** * Create a new TransientNameService, using all default attributes. */ public TransientNameService() { this(DEFAULT_SERVICE_HOST, DEFAULT_SERVICE_PORT, DEFAULT_SERVICE_NAME); } /** * Create a default-named name service using the specified host and port * parameters. * @param host The host to expose this under. * @param port The initial listening port. */ public TransientNameService(String host, int port) { this(host, port, DEFAULT_SERVICE_NAME); } /** * Create a specifically-named name service using the specified host and * port parameters. * @param host The host to expose this under. * @param port The initial listening port. * @param name The name to register this service under using the * BootManager. */ public TransientNameService(String host, int port, String name) { this.port = port; this.host = host; this.serviceName = name; } /** * Start up the name service, including creating an ORB instance to expose * it under. * @exception TransientServiceException */ public void run() throws TransientServiceException { // Create an ORB object java.util.Properties props = new Properties(); props.putAll(System.getProperties()); props.put("org.omg.CORBA.ORBServerId", "1000000"); props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); props.put("yoko.orb.oa.endpoint", "iiop --host " + host + " --port " + port); createdOrb = ORB.init((String[]) null, props); // now initialize the service initialize(createdOrb); } /** * Initialize a transient name service on a specific ORB. * @param orb The ORB hosting the service. * @exception TransientServiceException */ public void initialize(ORB orb) throws TransientServiceException { try { // Fire up the RootPOA POA rootPOA = (POA) orb.resolve_initial_references("RootPOA"); rootPOA.the_POAManager().activate(); // we need to create a POA to manage this named instance, and then activate a context on it. Policy[] policy = new Policy[3]; policy[0] = rootPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT); policy[1] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID); policy[2] = rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN); POA nameServicePOA = rootPOA.create_POA("TNameService", null, policy); nameServicePOA.the_POAManager().activate(); // create our initial context, and register that with the ORB as the name service initialContext = new TransientNamingContext(orb, nameServicePOA); // Resolve the Boot Manager and register the context object so we can resolve it using a corbaloc:: URL org.apache.yoko.orb.OB.BootManager bootManager = org.apache.yoko.orb.OB.BootManagerHelper.narrow(orb .resolve_initial_references("BootManager")); byte[] objectId = serviceName.getBytes(); bootManager.add_binding(objectId, initialContext.getRootContext()); // now register this as the naming service for the ORB as well. ((org.apache.yoko.orb.CORBA.ORB) orb).register_initial_reference("NameService", initialContext.getRootContext()); } catch (Exception e) { throw new TransientServiceException("Unable to initialize name service", e); } } /** * Destroy the created service. */ public void destroy() { // only destroy this if we created the orb instance. if (createdOrb != null) { createdOrb.destroy(); createdOrb = null; } } @Override public void close() throws Exception { destroy(); } }
6,894
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/CosNaming/tnaming/TransientNamingContext.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. */ /** * @version $Rev: 497539 $ $Date: 2007-01-18 11:16:12 -0800 (Thu, 18 Jan 2007) $ */ package org.apache.yoko.orb.CosNaming.tnaming; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.apache.yoko.orb.CosNaming.NamingContextBase; import org.omg.CORBA.INTERNAL; import org.omg.CORBA.ORB; import org.omg.CORBA.SystemException; import org.omg.PortableServer.POA; import org.omg.CosNaming.Binding; import org.omg.CosNaming.BindingHolder; import org.omg.CosNaming.BindingType; import org.omg.CosNaming.BindingTypeHolder; import org.omg.CosNaming.BindingIteratorHelper; import org.omg.CosNaming.BindingIteratorPOA; import org.omg.CosNaming.NameComponent; import org.omg.CosNaming.NamingContextHelper; import org.omg.CosNaming.NamingContext; import org.omg.CosNaming.NamingContextPackage.NotEmpty; public class TransientNamingContext extends NamingContextBase { // the bindings maintained by this context protected HashMap bindings = new HashMap(); // the root context object protected org.omg.CORBA.Object rootContext = null; /** * Create a top-level naming context. * * @param orb The orb hosting this context. * @param poa The POA used to activate the object. * * @exception Exception */ public TransientNamingContext(ORB orb, POA poa) throws Exception { this(orb, poa, null); // now get the initial root context as a corba object. byte[] objectId = poa.activate_object(this); rootContext = poa.id_to_reference(objectId); } /** * Construct a TransientNamingContext subcontext. * * @param orb The orb this context is associated with. * @param poa The POA the root context is activated under. * @param root The root context. * * @exception Exception */ public TransientNamingContext(ORB orb, POA poa, org.omg.CORBA.Object root) throws Exception { super(orb, poa); // save the root context link. rootContext = root; } // abstract methods part of the interface contract that the implementation is required // to supply. /** * Create a new context of the same type as the * calling context. * * @return A new NamingContext item. * @exception org.omg.CosNaming.NamingContextPackage.NotFound * @exception SystemException */ public NamingContext new_context() throws SystemException { try { // create a new context. Then we need to register this with the POA and activate it. TransientNamingContext newContext = new TransientNamingContext(orb, poa, rootContext); byte[] objectId = poa.activate_object(newContext); org.omg.CORBA.Object obj = poa.id_to_reference(objectId); return NamingContextHelper.narrow(obj); } catch (SystemException e) { // just propagate system exceptions throw e; } catch (Exception e) { throw (INTERNAL)(new INTERNAL("Unable to create new naming context").initCause(e)); } } /** * Destroy a context. This method should clean up * any backing resources associated with the context. * * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty */ public synchronized void destroy () throws org.omg.CosNaming.NamingContextPackage.NotEmpty { // still holding bound objects? Not allowed to destroy if (!bindings.isEmpty()) { throw new NotEmpty(); } try { // now detach ourselves from the POA byte[] objectId = poa.servant_to_id(this); if (objectId != null) { poa.deactivate_object(objectId); } } catch (Exception e) { // ignore } } /** * Create a list of bound objects an contexts contained * within this context. * * @param how_many The count of elements to return as a BindingList. * @param bl A holder element for returning the source binding list. * @param bi A holder for returning a BindingIterator. Any extra * elements not returned in the BindingList are returned * in the BindingIterator. * * @exception SystemException */ public synchronized void list(int how_many, org.omg.CosNaming.BindingListHolder bl, org.omg.CosNaming.BindingIteratorHolder bi) throws SystemException { TransientBindingIterator iterator = new TransientBindingIterator(poa, (HashMap)bindings.clone()); // have the iterator fill in the entries here iterator.next_n(how_many, bl); // now it's necessary to activate this iterator with the poa. The value we pass // back is the narrowed activated object try { byte[] objectId = poa.activate_object(iterator); org.omg.CORBA.Object obj = poa.id_to_reference(objectId); bi.value = BindingIteratorHelper.narrow(obj); } catch (SystemException e) { // just propagate system exceptions throw e; } catch (Exception e) { throw (INTERNAL)(new INTERNAL("Unable to activate BindingIterator").initCause(e)); } } // lower level functions that are used by the base class /** * Resolve an object in this context (single level * resolution). * * @param n The name of the target object. * @param type A type holder for returning the bound object type * information. * * @return The bound object. Returns null if the object does not * exist in the context. * @exception SystemException */ protected org.omg.CORBA.Object resolveObject(NameComponent n, BindingTypeHolder type) throws SystemException { // special call to resolve the root context. This is the only one that goes backwards. if (n.id.length() == 0 && n.kind.length() == 0) { // this is a name context item, so set it properly. type.value = BindingType.ncontext; return rootContext; } BindingKey key = new BindingKey(n); BoundObject obj = (BoundObject)bindings.get(key); // if not in the table, just return null if (obj == null) { return null; } // update the type information and return the bound object reference. type.value = obj.type; return obj.boundObject; } /** * Bind an object into the current context. This can * be either an object or a naming context. * * @param n The single-level name of the target object. * @param obj The object or context to be bound. * @param type * * @exception SystemException */ protected void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type) throws SystemException { // fairly simple table put... bindings.put(new BindingKey(n), new BoundObject(n, obj, type.value)); } /** * Unbind an object from the current context. * * @param n The name of the target object (single level). * * @return The object associated with the binding. Returns null * if there was no binding currently associated with this * name. * @exception SystemException */ protected org.omg.CORBA.Object unbindObject(NameComponent n) throws SystemException { //remove the object from the hash table, returning the bound object if it exists. BindingKey key = new BindingKey(n); BoundObject obj = (BoundObject)bindings.remove(key); if (obj != null) { return obj.boundObject; } return null; } /** * Retrieve the rootContext for this NamingContext. * * @return The rootContext CORBA object associated with this context. */ public org.omg.CORBA.Object getRootContext() { return rootContext; } /** * Internal class used for HashMap lookup keys. */ class BindingKey { // the name component this is a HashMap key for. public NameComponent name; private int hashval = 0; /** * Create a new BindingKey for a NameComponent. * * @param n The lookup name. */ public BindingKey(NameComponent n) { name = n; // create a hash value used for lookups if (name.id != null) { hashval += name.id.hashCode(); } if (name.kind != null) { hashval += name.kind.hashCode(); } } /** * Return the hashcode associated with this binding key. The * hashcode is created using the NameComponent id and * kind fields. * * @return The lookup hashvalue associated with this key. */ public int hashCode() { return hashval; } /** * Compare two BindingKeys for equality (used for HashMap * lookups). * * @param other The comparison partner. * * @return True if the keys are equivalent, false otherwise. */ public boolean equals(Object other) { // if not given or the wrong type, this is false. if (other == null || !(other instanceof BindingKey)) { return false; } BindingKey otherKey = (BindingKey)other; // verify first on the id name. if (name.id != null) { if (otherKey.name.id == null) { return false; } if (!name.id.equals(otherKey.name.id)) { return false; } } else { if (otherKey.name.id != null) { return false; } } // this is a match so far...now compare the kinds if (name.kind != null) { if (otherKey.name.kind == null) { return false; } if (!name.kind.equals(otherKey.name.kind)) { return false; } } else { if (otherKey.name.kind != null) { return false; } } return true; } } /** * Internal class used to store bound objects in the HashMap. */ public class BoundObject { // the name this object is bound under. public NameComponent name; // the type of binding (either nobject or ncontext). public BindingType type; // the actual bound object. public org.omg.CORBA.Object boundObject; /** * Create a new object binding for our HashMap. * * @param name The bound object's name. * @param boundObject * The bound object (real object or NamingContext). * @param type The type information associated with this binding. */ public BoundObject(NameComponent name, org.omg.CORBA.Object boundObject, BindingType type) { this.name = name; this.boundObject = boundObject; this.type = type; } } /** * Context implementation version of the BindingIterator * object used to return list items. */ public class TransientBindingIterator extends BindingIteratorPOA { // the POA used to activate this object (required for destroy(); private POA poa; // the binding set we're iterating over (this must be a snapshot copy) private HashMap bindings; // the iterator use to access the bindings private Iterator iterator; /** * Create a new BindingIterator hosted by the given POA and * iterating over the map of items. * * @param poa The hosting POA. * @param bindings The HashMap of bound objects. */ public TransientBindingIterator(POA poa, HashMap bindings) { this.poa = poa; this.bindings = bindings; this.iterator = bindings.values().iterator(); } /** * Return the next object in the iteration sequence. * * @param b The BindingHolder used to return the next item. If * we've reached the end of the sequence, an item * with an empty name is returned. * * @return true if there is another item, false otherwise. */ public boolean next_one(org.omg.CosNaming.BindingHolder b) { if (iterator.hasNext()) { // return this as a Binding value. BoundObject obj = (BoundObject)iterator.next(); b.value = new Binding(new NameComponent[] { obj.name }, obj.type); return true; } else { // return an empty element b.value = new Binding(new NameComponent[0], BindingType.nobject); return false; } } /** * Retrieve the next "n" items from the list, returned * as a BindingList. * * @param how_many The count of items to retrieve. * @param bl A holder for returning an array of Bindings for * the returned items. * * @return true if any items were returned, false if there's * nothing left to return. */ public boolean next_n(int how_many, org.omg.CosNaming.BindingListHolder bl) { List accum = new ArrayList(); BindingHolder holder = new BindingHolder(); int i = 0; // Keep iterating as long as there are entries while (i < how_many && next_one(holder)) { accum.add(holder.value); i++; } // convert to an array and return whether we found anything. bl.value = (Binding[])accum.toArray(new Binding[accum.size()]); return accum.isEmpty(); } /** * Destory this BindingIterator instance, which deativates * it from the hosting POA. */ public void destroy() { try { // we need to deactivate this from the POA. byte[] objectId = poa.servant_to_id(this); if (objectId != null) { poa.deactivate_object(objectId); } } catch (Exception e ) { } } } }
6,895
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/IOP/CodecFactory_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.IOP; final public class CodecFactory_impl extends org.omg.CORBA.LocalObject implements org.omg.IOP.CodecFactory { private org.omg.IOP.Codec cdrCodec_; // Cached CDR Codec private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // The // ORBInstance // ---------------------------------------------------------------------- // CodecFactory_impl public member implementation // ---------------------------------------------------------------------- public org.omg.IOP.Codec create_codec(org.omg.IOP.Encoding encoding) throws org.omg.IOP.CodecFactoryPackage.UnknownEncoding { org.apache.yoko.orb.OB.Assert._OB_assert(orbInstance_ != null); // TODO: check major/minor version if (encoding.format != org.omg.IOP.ENCODING_CDR_ENCAPS.value) throw new org.omg.IOP.CodecFactoryPackage.UnknownEncoding(); synchronized (this) { if (cdrCodec_ == null) cdrCodec_ = new CDRCodec(orbInstance_); } return cdrCodec_; } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ public void _OB_setORBInstance( org.apache.yoko.orb.OB.ORBInstance orbInstance) { orbInstance_ = orbInstance; } }
6,896
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/IOP/CDRCodec.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.IOP; import org.omg.IOP.CodecPackage.FormatMismatch; final class CDRCodec extends org.omg.CORBA.LocalObject implements org.omg.IOP.Codec { private org.apache.yoko.orb.OB.ORBInstance orbInstance_; // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public byte[] encode(org.omg.CORBA.Any data) { 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_ORBInstance(orbInstance_); out._OB_writeEndian(); out.write_any(data); byte[] result = new byte[buf.length()]; System.arraycopy(buf.data(), 0, result, 0, buf.length()); return result; } public org.omg.CORBA.Any decode(byte[] data) throws org.omg.IOP.CodecPackage.FormatMismatch { try { 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, 0, false); in._OB_ORBInstance(orbInstance_); in._OB_readEndian(); return in.read_any(); } catch (org.omg.CORBA.MARSHAL ex) { throw (org.omg.IOP.CodecPackage.FormatMismatch)new org.omg.IOP.CodecPackage.FormatMismatch().initCause(ex); } } public byte[] encode_value(org.omg.CORBA.Any data) { 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_ORBInstance(orbInstance_); out._OB_writeEndian(); data.write_value(out); byte[] result = new byte[buf.length()]; System.arraycopy(buf.data(), 0, result, 0, buf.length()); return result; } public org.omg.CORBA.Any decode_value(byte[] data, org.omg.CORBA.TypeCode tc) throws org.omg.IOP.CodecPackage.FormatMismatch, org.omg.IOP.CodecPackage.TypeMismatch { if (tc == null) throw new org.omg.IOP.CodecPackage.TypeMismatch(); try { 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, 0, false); in._OB_ORBInstance(orbInstance_); in._OB_readEndian(); org.apache.yoko.orb.CORBA.Any any = new org.apache.yoko.orb.CORBA.Any( orbInstance_, tc, null); any.read_value(in, tc); return any; } catch (org.omg.CORBA.MARSHAL ex) { throw (org.omg.IOP.CodecPackage.FormatMismatch)new org.omg.IOP.CodecPackage.FormatMismatch().initCause(ex); } } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ CDRCodec(org.apache.yoko.orb.OB.ORBInstance orbInstance) { orbInstance_ = orbInstance; } }
6,897
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/OBMessaging/UserExceptionRaiseProxy.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.OBMessaging; import org.apache.yoko.osgi.ProviderLocator; public class UserExceptionRaiseProxy { public void raise(org.omg.Messaging._ExceptionHolder execptHolder) throws org.omg.CORBA.UserException { } public void raise_with_list( org.omg.Messaging._ExceptionHolder exceptHolder, org.omg.CORBA.TypeCode[] exceptList) throws org.omg.CORBA.UserException { try { raise(exceptHolder); } catch (org.omg.CORBA.UserException ex) { org.omg.CORBA.Any any = new org.apache.yoko.orb.CORBA.Any(); Class exClass = ex.getClass(); String className = exClass.getName(); try { // // Get the helper class and the insert method with // appropriate parameter types // // get the appropriate class for the loading. Class c = ProviderLocator.loadClass(className + "Helper", exClass); Class[] paramTypes = new Class[2]; paramTypes[0] = org.omg.CORBA.Any.class; paramTypes[1] = exClass; java.lang.reflect.Method m = c.getMethod("insert", paramTypes); // // Build up the parameter list // Object[] parameters = new Object[2]; parameters[0] = any; parameters[1] = ex; // // No object is needed since this is a static method // call // m.invoke(null, parameters); } catch (ClassNotFoundException e) { // // REVISIT: // This just means that we probably caught a non-CORBA // exception. For now, we'll just throw this again. // // throw e; } catch (NoSuchMethodException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (IllegalAccessException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (IllegalArgumentException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (java.lang.reflect.InvocationTargetException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (SecurityException e) { // // REVISIT: // What do we do here? // } for (int i = 0; i < exceptList.length; ++i) { if (any.type().equal(exceptList[i])) throw ex; } } } public void register_as_proxy_with( org.omg.Messaging._ExceptionHolder exceptHolder) { org.apache.yoko.orb.OBMessaging.ExceptionHolder_impl exImpl = (org.apache.yoko.orb.OBMessaging.ExceptionHolder_impl) exceptHolder; exImpl._OB_register_raise_proxy(this); // // TODO: try/catch block??? // /* * org.apache.yoko.orb.OBMessaging.ExceptionHolder_impl exImpl = * (org.apache.yoko.orb.OBMessaging.ExceptionHolder_impl)exceptHolder; * * exImpl._OB_register_raise_proxy(this); */ } }
6,898
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/OBMessaging/ReplyHandler_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.OBMessaging; public interface ReplyHandler_impl extends org.omg.Messaging.ReplyHandler { public abstract void _OB_invoke(org.apache.yoko.orb.OB.Downcall down); }
6,899